Socket
Socket
Sign inDemoInstall

apollo-datasource-http

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-datasource-http - npm Package Compare versions

Comparing version 0.9.12 to 0.10.0

8

dist/src/http-data-source.d.ts

@@ -64,6 +64,6 @@ /// <reference types="node" />

protected onError?(_error: Error, requestOptions: Request): void;
protected get<TResult = unknown>(path: string, requestOptions?: RequestOptions): Promise<Response<TResult>>;
protected post<TResult = unknown>(path: string, requestOptions?: RequestOptions): Promise<Response<TResult>>;
protected delete<TResult = unknown>(path: string, requestOptions?: RequestOptions): Promise<Response<TResult>>;
protected put<TResult = unknown>(path: string, requestOptions?: RequestOptions): Promise<Response<TResult>>;
get<TResult = unknown>(path: string, requestOptions?: RequestOptions): Promise<Response<TResult>>;
post<TResult = unknown>(path: string, requestOptions?: RequestOptions): Promise<Response<TResult>>;
delete<TResult = unknown>(path: string, requestOptions?: RequestOptions): Promise<Response<TResult>>;
put<TResult = unknown>(path: string, requestOptions?: RequestOptions): Promise<Response<TResult>>;
private performRequest;

@@ -70,0 +70,0 @@ private request;

{
"name": "apollo-datasource-http",
"version": "0.9.12",
"version": "0.10.0",
"author": "Dustin Deus <deusdustin@gmail.com>",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -71,5 +71,12 @@ # Apollo HTTP Data Source

// manipulate request before it is send
// for example assign a AbortController signal to all requests and abort
request.signal = this.context.abortController.signal
setTimeout(() => {
this.context.abortController.abort()
}, 3000).unref()
}
onResponse<TResult = unknown>(request: Request, response: Response<TResult>): void {
onResponse<TResult = unknown>(request: Request, response: Response<TResult>): Response<TResult> {
// manipulate response or handle unsuccessful response in a different way

@@ -88,2 +95,5 @@ return super.onResponse(request, response)

},
context: {
tracingName: 'getMovie',
},
headers: {

@@ -99,5 +109,2 @@ 'X-Foo': 'bar',

})()
// cancel all running requests e.g when the request is closed prematurely
datasource.abort()
```

@@ -110,3 +117,3 @@

- `onResponse` - Is executed when a response has been received. This can be used to alter the response before it is passed to caller or to log errors.
- `onError` - Is executed for any error.
- `onError` - Is executed for any request error.

@@ -113,0 +120,0 @@ ## Error handling

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc