Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response data incorrect. #11

Open
dreamdev21 opened this issue Jan 18, 2019 · 3 comments
Open

Response data incorrect. #11

dreamdev21 opened this issue Jan 18, 2019 · 3 comments

Comments

@dreamdev21
Copy link

dreamdev21 commented Jan 18, 2019

I am using this one. Seems good work to increase request timeout. 👍
When I am using React Native fetch, my response like this:

{ type: 'default',
  status: 200,
  ok: true,
  statusText: 200,
  headers: 
   { map: 
      { expires: '0',
        date: 'Fri, 18 Jan 2019 16:58:02 GMT',
        'cache-control': 'no-cache, no-store, must-revalidate',
        etag: 'W/"da-6bFyDrImvMLQzmRrsCZZfgxtxGU"',
        pragma: 'no-cache',
        'content-type': 'text/html; charset=utf-8',
        'content-length': '218',
        'x-powered-by': 'Express',
        connection: 'close' } },
  url: '',
  _bodyInit: '{"message":"SUCCESS","name":"Webm successfully created.","webm":"url"}',
  _bodyText: '{"message":"SUCCESS","name":"Webm successfully created.","webm":"url"}' }

But using this package, response like this:

{ type: 'default',
  status: 200,
  ok: true,
  statusText: 200,
  headers: 
   { map: 
      { expires: '0',
        date: 'Fri, 18 Jan 2019 17:01:36 GMT',
        'cache-control': 'no-cache, no-store, must-revalidate',
        etag: 'W/"da-A1q0qbpER+GrId+SH3CDzv53AYE"',
        pragma: 'no-cache',
        'content-type': 'text/html; charset=utf-8',
        'content-length': '218',
        'x-powered-by': 'Express',
        connection: 'close' } },
  url: '',
  _bodyInit: 
   { listeners: {},
     isRNFetchBlobPolyfill: true,
     multipartBoundary: null,
     _ref: '/Users/webbusiness/Library/Developer/CoreSimulator/Devices/7337DDEB-2116-4BFA-AFE2-CA66FF3ABD12/data/Containers/Data/Application/A98729DE-64C1-418F-A2F1-68BEF8D67050/Documents/RNFetchBlob-blobs/blob-3ejkhkazbpv55cxl5je8dl',
     _blobCreated: true,
     _closed: false,
     cacheName: 'blob-3ejkhkazbpv55cxl5je8dl',
     type: 'text/plain',
     size: 218 },
  _bodyBlob: 
   { listeners: {},
     isRNFetchBlobPolyfill: true,
     multipartBoundary: null,
     _ref: '/Users/webbusiness/Library/Developer/CoreSimulator/Devices/7337DDEB-2116-4BFA-AFE2-CA66FF3ABD12/data/Containers/Data/Application/A98729DE-64C1-418F-A2F1-68BEF8D67050/Documents/RNFetchBlob-blobs/blob-3ejkhkazbpv55cxl5je8dl',
     _blobCreated: true,
     _closed: false,
     cacheName: 'blob-3ejkhkazbpv55cxl5je8dl',
     type: 'text/plain',
     size: 218 } }

Not sure why is different?

My dev info:

React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.6
      CPU: (4) x64 Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
      Memory: 420.38 MB / 8.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 10.13.0 - /usr/local/bin/node
      npm: 6.4.1 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0
      Android SDK:
        API Levels: 23, 25, 26, 27, 28
        Build Tools: 26.0.3, 27.0.3, 28.0.3
        System Images: android-26 | Google APIs Intel x86 Atom_64, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 3.2 AI-181.5540.7.32.5056338
      Xcode: 10.0/10A255 - /usr/bin/xcodebuild
    npmPackages:
      react: ^16.0.0 => 16.6.0
      react-native: ^0.57.8 => 0.57.8
    npmGlobalPackages:
      eslint-plugin-react-native: 3.5.0
      react-native-cli: 2.0.1
@jan-happy
Copy link

I have the same problem.

@dreamdev21
Copy link
Author

I am using axios instead of this one.

@OroszD
Copy link

OroszD commented Jun 30, 2019

You have to call the json() function on your response.
return fetch(request) .then((response) => {response.json()}) .then((responseJSON) => { //responseJSON will contain your response }) .catch(error => { return error; });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants