aurelia / http-client

A simple, restful, message-based wrapper around XMLHttpRequest.
MIT License
62 stars 59 forks source link

Empty post result triggers error result: 'Unexpected end of input at Object.parse' #131

Closed andrewharry closed 8 years ago

andrewharry commented 8 years ago

I have hit an issue with the Http-Client when dealing with an empty result. The post returns a blank 200 status upon success. The http client triggers a catch on the promise.

Stack trace in error message: "SyntaxError: Unexpected end of input at Object.parse (native) at HttpResponseMessage.get (http://localhost:9000/jspm_packages/npm/aurelia-http-client@1.0.0-beta.1.2.0/aurelia-http-client.js:205:34"

Below are the relevant response headers:

HTTP/1.1 200 OK Cache-Control: no-cache Pragma: no-cache Expires: -1 Access-Control-Allow-Headers: Content-Type,Authorization Access-Control-Allow-Methods: GET,POST,PATCH Access-Control-Allow-Origin: * Date: Thu, 14 Apr 2016 05:33:00 GMT Content-Length: 0

andrewharry commented 8 years ago

I just modified the post method on the server to return some text 'Success' and this error cleared up. So it looks like it is a genuine issue with handling empty results