Describe the bug
http.fetch always expects a reponse body, therefore throws an error when there is none.
To Reproduce
Steps to reproduce the behavior:
- Run an
http.fetch request that will return no response body and without defining responseType ;
- See the following error :
Failed to parse response as JSON: SyntaxError: JSON Parse error: Unexpected EOF; try setting the responseType option to ResponseType.Text or ResponseType.Binary if the API does not return a JSON response.
Expected behavior
The request succeeds.
Platform and Versions (required):
Operating System - Linux, version 19.3 X64
Node.js environment
Node.js - 14.18.1
@tauri-apps/cli - 1.0.0-beta.10
@tauri-apps/api - 1.0.0-beta.8
Global packages
npm - 8.1.0
yarn - 1.22.15
Rust environment
rustc - 1.53.0
cargo - 1.53.0
App directory structure
/dist
/node_modules
/.idea
/src
/src-tauri
/.git
/.parcel-cache
App
tauri.rs - 1.0.0-beta.8
build-type - bundle
CSP - default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'
distDir - ../dist
devPath - http://localhost:1234
Additional context
This error was spotted during the development of axios-tauri-adapter-test, the unit test project for axios-tauri-adapter.
Stack Trace
Not applicable
Describe the bug
http.fetchalways expects a reponse body, therefore throws an error when there is none.To Reproduce
Steps to reproduce the behavior:
http.fetchrequest that will return no response body and without definingresponseType;Failed to parse response as JSON: SyntaxError: JSON Parse error: Unexpected EOF; try setting the responseType option to ResponseType.Text or ResponseType.Binary if the API does not return a JSON response.Expected behavior
The request succeeds.
Platform and Versions (required):
Additional context
This error was spotted during the development of
axios-tauri-adapter-test, the unit test project foraxios-tauri-adapter.Stack Trace
Not applicable