change in behaviour of POST between 1.14.0 and 1.15.0
See original GitHub issueIt seems a change was introduced sometime in 1.15.0
This used to work
fun getSessionInfo(tokenId: String): AmSession {
logger.debug { "fetching info for session: $tokenId" }
val (req, res, result) =
http.request(
method = Method.POST,
path = "/json/sessions?_action=getSessionInfo&tokenId=$tokenId"
)
.header("Accept-API-Version" to "resource=2.0")
.header("Content-Type" to "application/json")
.responseString()
logger.debug { "\n${req.cUrlString()}\n--> $req\n$res" }
result.fold({ d ->
return Json().parse(d)
}, { err ->
throw err.exception
})
}
and it sent this request
$ curl -i -X POST -H "Accept-Encoding:compress;q=0.5, gzip;q=1.0" -H "Content-Type:application/json" -H "Accept:application/json" -H "Accept-API-Version:resource=2.0" https://authserver/json/sessions?_action=getSessionInfo&tokenId=d5zqRsYnIPTqXvZRZGvdEdOB9Gs.*AAJTSQACMDIAAlNLABxPWFZLMHRhMHBHeXl6YjMrQ1h5Wk5LdGJubFk9AAJTMQACMDE.*
--> "Body : (empty)"
"Headers : (4)"
Accept-Encoding : compress;q=0.5, gzip;q=1.0
Content-Type : application/json
Accept : application/json
Accept-API-Version : resource=2.0
Notice the content type is “application/json” as is expected due to it being requested in code example on line 10
however in newer versions the request is this, notice the content type header being appended for some reason, instead of overwritting
$ curl -i -X POST -H "Accept-Encoding:compress;q=0.5, gzip;q=1.0" -H "Content-Type:application/x-www-form-urlencoded; application/json" -H "Accept:application/json" -H "Accept-API-Version:resource=2.0" https://authserver/json/sessions?_action=getSessionInfo&tokenId=d5zqRsYnIPTqXvZRZGvdEdOB9Gs.*AAJTSQACMDIAAlNLABxPWFZLMHRhMHBHeXl6YjMrQ1h5Wk5LdGJubFk9AAJTMQACMDE.*
--> --> https://authserver/json/sessions?_action=getSessionInfo&tokenId=d5zqRsYnIPTqXvZRZGvdEdOB9Gs.*AAJTSQACMDIAAlNLABxPWFZLMHRhMHBHeXl6YjMrQ1h5Wk5LdGJubFk9AAJTMQACMDE.*
"Body : (empty)"
"Headers : (4)"
Accept-Encoding : compress;q=0.5, gzip;q=1.0
Content-Type : application/x-www-form-urlencoded; application/json
Accept : application/json
Accept-API-Version : resource=2.0
content type now for whatever reason is Content-Type : application/x-www-form-urlencoded; application/json
The server in this instance cant handle that, but the issue is that Fuel is doing something other than what the code tells it to do, it should send Content-Type : application/json as that is what was specified in code
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
Top Results From Across the Web
tensorflow + numpy compatibility? · Issue #31249 - GitHub
The warning is harmless to end users, and there is no need to downgrade. Aside from emitting a warning, the behavior has not...
Read more >The conflict is caused by: The user requested tensorboard ...
The key here is this: The conflict is caused by: The user requested tensorboard==2.1.0 tensorflow 1.15.4 depends on tensorboard<1.16.0 and > ...
Read more >Release 1.15.0
TensorFlow GPU binaries are now built against CUDA 10 and TensorRT 5.0. Support for Python3.7 on all operating systems. Moved NCCL to core....
Read more >#5328 (ODE solver behaves erratically in two MultiBody ...
Summary changed from ODE solver behaves erratically in two MuliBody examples (issue with state selection?) to ODE solver behaves erratically in two MultiBody ......
Read more >TensorFlow for Jetson Platform Release Notes
As of the 20.02 release, the TensorFlow package has been renamed from tensorflow-gpu to tensorflow . This change will only affect the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@SleeplessByte @fnunezkanut The reason this was added was to support multiple headers by the same key.
if you change your code from
to
I believe that it will overwrite the values if that is what you require. If I have any of the above wrong then please let me know and I will investigate further
@kittinunf @markGilchrist
Content-Type
is not a header that can be appended to. Changing this into something likeallows you to keep the old behaviour whilst supporting the new behaviour.