
Security News
Python Adopts Standard Lock File Format for Reproducible Installs
Python has adopted a standardized lock file format to improve reproducibility, security, and tool interoperability across the packaging ecosystem.
fetch-multipart-graphql
Advanced tools
Cross browser function to fetch and parse streaming multipart graphql responses.
Cross-browser function to fetch and parse streaming multipart graphql responses.
This allows you to efficiently fetch streamed GraphQL responses that use the @defer directive as supported by Apollo Server. It can be easily used in a Relay Modern network layer to support deferred queries.
In a Relay Network Layer:
import fetchMultipart from 'fetch-multipart-graphql';
import { Observable } from 'relay-runtime';
function fetchQuery(operation, variables) {
return Observable.create(sink => {
fetchMultipart('/graphql', {
method: 'POST',
headers: {
'content-type': 'application/json',
},
body: JSON.stringify({
query: operation.text,
variables,
}),
credentials: 'same-origin',
onNext: parts => sink.next(parts),
onError: err => sink.error(err),
onComplete: () => sink.complete(),
});
});
}
The credentials
param is passed to fetch
. For XHR requests, XMLHttpRequest.withCredentials
is mapped to true when credentials: 'include'
.
Tested in the latest Chrome, Firefox, Safari, Edge, and Internet Explorer 11. Requires a polyfill for TextEncoder/Decoder. Since only utf-8 encoding is required, it's recommended to use text-encoding-utf-8 to minimize impact on bundle size.
FAQs
Cross browser function to fetch and parse streaming multipart graphql responses.
The npm package fetch-multipart-graphql receives a total of 1,323 weekly downloads. As such, fetch-multipart-graphql popularity was classified as popular.
We found that fetch-multipart-graphql demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Python has adopted a standardized lock file format to improve reproducibility, security, and tool interoperability across the packaging ecosystem.
Security News
OpenGrep has restored fingerprint and metavariable support in JSON and SARIF outputs, making static analysis more effective for CI/CD security automation.
Security News
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.