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

PUT Response status code 204 treated as error #51

Open
czoIg opened this issue Jan 30, 2022 · 2 comments
Open

PUT Response status code 204 treated as error #51

czoIg opened this issue Jan 30, 2022 · 2 comments

Comments

@czoIg
Copy link
Contributor

czoIg commented Jan 30, 2022

Hi!
After making PUT request, response status code is 204 (no content), which is valid response, but go-redmine treats it as error and tries decode content body which is empty string.
Here it is:

if res.StatusCode != 200 {

In Redmine docs there are some pages that describes 204 code as confirmation that requested change was made:
https://www.redmine.org/projects/redmine/wiki/Rest_IssueCategories#PUT
https://www.redmine.org/projects/redmine/wiki/Rest_Memberships#PUT
https://www.redmine.org/projects/redmine/wiki/Rest_TimeEntries#Updating-a-time-entry
etc.

@mattn
Copy link
Owner

mattn commented Jan 30, 2022

Okay, could you please send me pull-request like below?

res.StatusCode / 100 == 2

czoIg added a commit to czoIg/go-redmine that referenced this issue Jan 31, 2022
@czoIg
Copy link
Contributor Author

czoIg commented Jan 31, 2022

Thanks for fast reply. PR is done: Ref #52

czoIg added a commit to czoIg/go-redmine that referenced this issue Jan 31, 2022
mattn added a commit that referenced this issue Jun 8, 2022
Fix redmine response status handling. Ref #51
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