Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$mimeType parameter in body() method sets the expects as well as sends mime type. #119

Closed
BAM5 opened this issue Feb 24, 2014 · 3 comments
Closed

Comments

@BAM5
Copy link

BAM5 commented Feb 24, 2014

This should be fixed so that it only sets the mime type of what is being passed in body, aka, the mime type of the data being sent.
At the very least it should be documented.

@nategood
Copy link
Owner

Agree it should be documented. In order to make it non breaking for now,
we may start by adding another optional argument to specify expects mime
type.
On Feb 24, 2014 6:38 PM, "BAM5" [email protected] wrote:

This should be fixed so that it only sets the mime type of what is being
passed in body, aka, the mime type of the data being sent.
At the very least it should be documented.

Reply to this email directly or view it on GitHubhttps://github.com//issues/119
.

@BAM5
Copy link
Author

BAM5 commented Feb 25, 2014

That would be good.
But yes, my code was not performing as expected because I set the mimeType parameter to urlencoded, because that was what the post body content was. It was a logical assumption because $mimeType clearly only applies to the body that I'm sending since it's in the body method right? And then when the server returned JSON I was unable to access $response->body like I should have. Took about 15 minutes of debugging and trace to figure out the problem.

Personally I think it should just set the mime type of the content you're passing to body(), there are other functions that set the expected return mime type, plus there's also the smart parsing from the response's content-type header.

nategood pushed a commit that referenced this issue May 21, 2014
As pointed out in Issue #119, this may produce unexpected results. The behavior of this parameter
will change in the next minor release. See r0.3.0 branch.
nategood pushed a commit that referenced this issue May 21, 2014
As pointed out in Issue #119, setting expects here may produce unexpected results.
@nategood
Copy link
Owner

Agree that this could cause unexpected behavior, will change this behavior in the next MINOR version update, 0.3.0 (see r0.3.0 branch). I have updated the docs for now on master.

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

No branches or pull requests

2 participants