Skip to content

fix duplicated Content-Type values#247

Merged
pcantrell merged 3 commits intobustoutsolutions:masterfrom
massdonati:fix/duplicated_contentType_value
Jun 22, 2018
Merged

fix duplicated Content-Type values#247
pcantrell merged 3 commits intobustoutsolutions:masterfrom
massdonati:fix/duplicated_contentType_value

Conversation

@massdonati
Copy link
Copy Markdown

fix issue #246

@massdonati massdonati force-pushed the fix/duplicated_contentType_value branch from 3fdb631 to a9bcda7 Compare June 11, 2018 17:21
@pcantrell pcantrell merged commit 27dd4f9 into bustoutsolutions:master Jun 22, 2018
underlyingRequest in

underlyingRequest.addValue(contentType, forHTTPHeaderField: "Content-Type")
underlyingRequest.setValue(contentType, forHTTPHeaderField: "Content-Type")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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")
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants