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

1176734451 #5

Closed
6 tasks done
FW1342 opened this issue Jul 13, 2022 · 1 comment
Closed
6 tasks done

1176734451 #5

FW1342 opened this issue Jul 13, 2022 · 1 comment

Comments

@FW1342
Copy link
Owner

FW1342 commented Jul 13, 2022

@FW1342 FW1342 pinned this issue Jul 13, 2022
Repository owner locked and limited conversation to collaborators Jul 13, 2022
@FW1342
Copy link
Owner Author

FW1342 commented Jul 13, 2022

github version
account ------
------ ------
------ ------
------ ------
           |      |      |        |             |       | account. - [x] https://github.com/manggoes-American-22-cream-team/cve-cve-2022-11585/issues/4
  • -80.0000=2.00000/@480/@A89F/Thiadevice/0P8C5X
    webshare1

        [
          
        ](https://user-images.githubusercontent.com/107682682/177639743-7bae71f7-093b-4f9f-ae82-e3316f986352.gif)
        
            ![webshare1](https://user-images.githubusercontent.com/107682682/177639743-7bae71f7-093b-4f9f-ae82-e3316f986352.gif)
          
        
          
            
              
            
            
              
              
            
          
          [
            
              
            
          ](https://user-images.githubusercontent.com/107682682/177639743-7bae71f7-093b-4f9f-ae82-e3316f986352.gif)
    

    cross-fetch
    NPM Version
    Downloads Per Week
    License: MIT
    CI
    codecov

Universal WHATWG Fetch API for Node, Browsers and React Native. The scenario that cross-fetch really shines is when the same JavaScript codebase needs to run on different platforms.

  • Platform agnostic: browsers, Node or React Native
  • Optional polyfill: it's up to you if something is going to be added to the global object or not
  • Simple interface: no instantiation, no configuration and no extra dependency
  • WHATWG compliant: it works the same way wherever your code runs
  • TypeScript support: better development experience with types.

Table of Contents

Install

npm install --save cross-fetch

As a ponyfill:

// Using ES6 modules with Babel or TypeScript
import fetch from 'cross-fetch';

// Using CommonJS modules
const fetch = require('cross-fetch');

As a polyfill:

// Using ES6 modules
import 'cross-fetch/polyfill';

// Using CommonJS modules
require('cross-fetch/polyfill');

The CDN build is also available on unpkg:

<script src="//unpkg.com/cross-fetch/dist/cross-fetch.js"></script>

This adds the fetch function to the window object. Note that this is not UMD compatible.

Usage

With promises:

import fetch from 'cross-fetch';
// Or just: import 'cross-fetch/polyfill';

fetch('//api.github.com/users/lquixada')
  .then(res => {
    if (res.status >= 400) {
      throw new Error("Bad response from server");
    }
    return res.json();
  })
  .then(user => {
    console.log(user);
  })
  .catch(err => {
    console.error(err);
  });

With async/await:

import fetch from 'cross-fetch';
// Or just: import 'cross-fetch/polyfill';

(async () => {
  try {
    const res = await fetch('//api.github.com/users/lquixada');
    
    if (res.status >= 400) {
      throw new Error("Bad response from server");
    }
    
    const user = await res.json();
  
    console.log(user);
  } catch (err) {
    console.error(err);
  }
})();

⚠️ Warning: If you're in an environment that doesn't support Promises such as Internet Explorer, you must install an ES6 Promise compatible polyfill. es6-promise is suggested.

Demo & API

You can find a comprehensive doc at Github's fetch page. If you want to play with cross-fetch, check our JSFiddle playground.

Tip: Run the fiddle on various browsers and with different settings (for instance: cross-domain requests, wrong urls or text requests). Don't forget to open the console in the test suite page and play around.

FAQ

Yet another fetch library?

I did a lot of research in order to find a fetch library that could be simple, cross-platform and provide polyfill as an option. There's a plethora of libs out there but none could match those requirements.

Why not isomorphic-fetch?

My preferred library used to be isomorphic-fetch but it has this bug that prevents it from running in a react native environment. It seems unlikely to be fixed since there haven't been any new commits to it since 2016. That means dependencies are outdated as well.

Why polyfill might not be a good idea?

In a word? Risk. If the spec changes in the future, it might be problematic to debug. Read more about it on sindresorhus's ponyfill page. It's up to you if you're fine with it or not.

How does cross-fetch work?

Just like isomorphic-fetch, it is just a proxy. If you're in node, it delivers you the node-fetch library, if you're in a browser or React Native, it delivers you the github's whatwg-fetch. The same strategy applies whether you're using polyfill or ponyfill.

Who's Using It?

The New York Times Apollo GraphQL Facebook Swagger VulcanJS graphql-request
The New York Times Apollo GraphQL Facebook Swagger VulcanJS graphql-request

Thanks

Heavily inspired by the works of matthew-andrews. Kudos to him!

License

cross-fetch is licensed under the MIT license © Leonardo Quixadá

Author

[@lA89F(https://avatar1.githubusercontent.com/u/17111268?v=4&SR=98)
@lSSH
401d2c2]

_Originally posted by @FW1342 in manggoes-American-22-cream-team/cve-cve-2022-11585#4

CLA assistant check(https://cla.opensource.microsoft.com/microsoft/azure-pipelines-tasks?pullRequest=16574) Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our

Contributor License Agreement

** before we can accept your contribution from FW1342 with labels**

sign now

You have signed the CLA already but the status is still pending? Let us


| 480 |

0P8C5X
A89F
CLA
-----

|

microsoft/azure-pipelines-tasks#16574 (comment)

http://cla.opensource.microsoft.com/check/microsoft/azure/?pullRequest=16574 it

 | number |     |                || -------------- |         |                | pipelines |      | account name  |           |         | -------------- |<!/html> | ``             

| aaccount | email |
| ----------| ------------------ |
| iriebrain | irieg420@gmail.com |
`| ----- | ----- |``**

@FW1342 FW1342 closed this as completed Jul 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant