fix duplicated Content-Type values#247
Conversation
3fdb631 to
a9bcda7
Compare
| underlyingRequest in | ||
|
|
||
| underlyingRequest.addValue(contentType, forHTTPHeaderField: "Content-Type") | ||
| underlyingRequest.setValue(contentType, forHTTPHeaderField: "Content-Type") |
There was a problem hiding this comment.
It took me a while digging into Siesta 1.4 to understand what happened to my failing request.
I arrived here @pcantrell and I think this will break quite some code around.
At some point in my app I have a Resource R1 I need to load using a Resource R2.
R1.load(using: R2.withParam("someParam", value).request(.post, text: "SomeText") )
Doing this the request contentType param has its default "text/plain" value
The change-set here is going to overwrite completely the contenType stored by my Service Resource Configuration.
I don't think this is a wanted behaviour. Isn't it?
There was a problem hiding this comment.
I guess this can be a viable solution. I Can't produce a fully tested PR due to my limited time. Sorry about it.
if underlyingRequest.value(forHTTPHeaderField: "Content-Type")?.contains(contentType) == false {
underlyingRequest.addValue(contentType, forHTTPHeaderField: "Content-Type")
}
fix issue #246