You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem:
Currently, the response from an HTTP request is being parsed, regardless of the status code. This behavior leads to the following error in the browser's debugger menu: "SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data" when the status code is 204 (No Content). The error is triggered in Firefox.
Expected Behavior:
The parsing of the response data should only occur when the status code is not 204. When the status code is 204, the response should be left unparsed.
Steps to Reproduce:
Perform an HTTP request that returns a status code of 204.
Observe the error in the browser's debugger menu.
Code Segment:
returnres[options.responseType||'text']().then((data)=>{response.data=data;// its okay if this fails: response.data will be the unparsed value:response.data=JSON.parse(data);}).catch(Object).then(()=>{constok=options.validateStatus ? options.validateStatus(res.status) : res.ok;returnok ? response : Promise.reject(response);});
Possible Solution:
To resolve this issue, you could modify the code to conditionally parse the response data based on the status code.
Additional Information:
Browser/Environment: Firefox
Redaxios Version: 0.5.1
The text was updated successfully, but these errors were encountered:
Problem:
Currently, the response from an HTTP request is being parsed, regardless of the status code. This behavior leads to the following error in the browser's debugger menu:
"SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data"
when the status code is 204 (No Content). The error is triggered in Firefox.Expected Behavior:
The parsing of the response data should only occur when the status code is not 204. When the status code is 204, the response should be left unparsed.
Steps to Reproduce:
Code Segment:
Possible Solution:
To resolve this issue, you could modify the code to conditionally parse the response data based on the status code.
Additional Information:
Firefox
0.5.1
The text was updated successfully, but these errors were encountered: