taskcluster / taskcluster-client-web

A Taskcluster client library for the browser
Mozilla Public License 2.0
3 stars 8 forks source link

Don't try to parse response body unless it's JSON #12

Closed djmitche closed 6 years ago

djmitche commented 6 years ago

Lots of services respond with a 204 status, which doesn't even have a body.

This is causing issues with the purge-cache service for example.

eliperelman commented 6 years ago

Do we get a different response type in those instances, or should we directly check for 204?

djmitche commented 6 years ago

I'm not sure if the Content-Type is set incorrectly, or what, if that's what you mean.

eliperelman commented 6 years ago

Yeah, that's all I was wondering was if it still used application/json.

djmitche commented 6 years ago

screenshot from 2017-09-25 11-54-46

Looks like no, no content-type. And an empty body. But I still got "Error executing operation: SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data" in the purge-caches tool.