Skip to content

Commit

Permalink
feat: omit content-type header when no parameters are present
Browse files Browse the repository at this point in the history
  • Loading branch information
tangcent committed Oct 9, 2024
1 parent bf67a5c commit 5e9c24c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -562,12 +562,13 @@ abstract class RequestClassExporter : ClassExporter {
)
}

if (request.hasBodyOrForm()) {
requestBuilderListener.addHeaderIfMissed(
methodExportContext,
request, "Content-Type", "application/x-www-form-urlencoded"
)
}
// no longer need to set content-type here
//if (request.hasBodyOrForm()) {
// requestBuilderListener.addHeaderIfMissed(
// methodExportContext,
// request, "Content-Type", "application/x-www-form-urlencoded"
// )
//}

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,6 @@ test apis

| `name` | `value` | `desc` |
| ------------ | ------------ | ----: |
| Content-Type | application/x-www-form-urlencoded | |
| token | | auth token |


Expand Down Expand Up @@ -799,7 +798,6 @@ test apis

| `name` | `value` | `desc` |
| ------------ | ------------ | ----: |
| Content-Type | application/x-www-form-urlencoded | |
| token | | auth token |


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,6 @@ test apis

| name | value | required | desc |
| ------------ | ------------ | ------------ | ------------ |
| Content-Type | application/x-www-form-urlencoded | YES | |
| token | | YES | auth token |


Expand Down Expand Up @@ -797,7 +796,6 @@ test apis

| name | value | required | desc |
| ------------ | ------------ | ------------ | ------------ |
| Content-Type | application/x-www-form-urlencoded | YES | |
| token | | YES | auth token |


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1421,12 +1421,6 @@
"method": "POST",
"description": "",
"header": [
{
"key": "Content-Type",
"value": "application/x-www-form-urlencoded",
"type": "text",
"description": ""
},
{
"key": "token",
"value": "",
Expand Down Expand Up @@ -1454,12 +1448,6 @@
"method": "POST",
"description": "",
"header": [
{
"key": "Content-Type",
"value": "application/x-www-form-urlencoded",
"type": "text",
"description": ""
},
{
"key": "token",
"value": "",
Expand Down Expand Up @@ -1517,12 +1505,6 @@
"method": "POST",
"description": "",
"header": [
{
"key": "Content-Type",
"value": "application/x-www-form-urlencoded",
"type": "text",
"description": ""
},
{
"key": "token",
"value": "",
Expand Down Expand Up @@ -1550,12 +1532,6 @@
"method": "POST",
"description": "",
"header": [
{
"key": "Content-Type",
"value": "application/x-www-form-urlencoded",
"type": "text",
"description": ""
},
{
"key": "token",
"value": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,12 +486,6 @@
"__v": 0,
"markdown": "",
"req_headers": [
{
"name": "Content-Type",
"value": "application/x-www-form-urlencoded",
"example": "application/x-www-form-urlencoded",
"required": 1
},
{
"name": "token",
"value": "",
Expand Down Expand Up @@ -528,12 +522,6 @@
"__v": 0,
"markdown": "",
"req_headers": [
{
"name": "Content-Type",
"value": "application/x-www-form-urlencoded",
"example": "application/x-www-form-urlencoded",
"required": 1
},
{
"name": "token",
"value": "",
Expand Down

0 comments on commit 5e9c24c

Please sign in to comment.