- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2
fix(callAPIMethod): bug ff & safari #26
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
Conversation
        
          
                src/callAPIMethod.js
              
                Outdated
          
        
      | return fetch(url, {...defaults.fetchOptions, ...fetchOptions, ...options}) | ||
| .then( result => { | ||
| const promiseCallback = result.body ? result[method]() : new Promise(resolve => resolve(result.body)); | ||
| const promiseCallback = result[method](); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ya-woodcutter according to https://developer.mozilla.org/en-US/docs/Web/API/Response
Response implements Body. I think the issue is with isomorphic-fetch not being really isomorphic and using node-fetch underneath.
Did you try using Response.blob() instead?
const promiseCallback =  result[result.body ? method : 'blob']();There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the issue is with isomorphic-fetch not being really isomorphic...
Isomorphic-fetch implements the minimal functionality of fetch.
Did you try using Response.blob() instead?
I didn't try to do it. But I think that the transform data from Blob to the right data type will be problematic. It requires additional conditions.
I'll try to do something in this way.
| Now:
 | 
| @ya-woodcutter Sorry I've fucked up your pr | 
| @TimeRaider ? emm... it's ok :) | 
094cbda    to
    56f86c9      
    Compare
  
    56f86c9    to
    f6c360a      
    Compare
  
    d9e87b8    to
    ec4e3af      
    Compare
  
    
    
      
        1 similar comment
      
    
  
            
          
                src/callAPIMethod.js
              
                Outdated
          
        
      | }) | ||
| .then( response => response[method]() | ||
| .catch( () => { | ||
| if (!response.ok) { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep the same codestyle everywhere
ff & safari (isomorphic-fetch) doesn't support response.body