mattn / go-redmine

MIT License
185 stars 80 forks source link

PUT Response status code 204 treated as error #51

Open czoIg opened 2 years ago

czoIg commented 2 years ago

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: https://github.com/mattn/go-redmine/blob/b2dd06078c5c918c133727c594e4f6f7364263b0/issue.go#L225

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 commented 2 years ago

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

res.StatusCode / 100 == 2
czoIg commented 2 years ago

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