apollo-datasource-http
Advanced tools
Comparing version 0.15.0 to 0.16.0
@@ -5,3 +5,3 @@ /// <reference types="node" /> | ||
import { ResponseData } from 'undici/types/dispatcher'; | ||
import { EventEmitter, Readable } from 'stream'; | ||
import { EventEmitter } from 'stream'; | ||
import { Logger } from 'apollo-server-types'; | ||
@@ -26,14 +26,9 @@ declare type AbortSignal = unknown; | ||
} | ||
export declare type RequestOptions = { | ||
context?: Dictionary<string>; | ||
query?: Dictionary<string | number>; | ||
body?: string | Buffer | Uint8Array | Readable | null; | ||
headers?: Dictionary<string>; | ||
signal?: AbortSignal; | ||
} & CacheTTLOptions; | ||
export declare type RequestOptions = Omit<Partial<Request>, 'origin' | 'path' | 'method'>; | ||
export declare type Request = { | ||
context: Dictionary<string>; | ||
query: Dictionary<string | number>; | ||
body: string | Buffer | Uint8Array | Readable | null; | ||
body: any; | ||
signal?: AbortSignal | EventEmitter | null; | ||
json?: boolean; | ||
origin: string; | ||
@@ -40,0 +35,0 @@ path: string; |
@@ -135,3 +135,3 @@ "use strict"; | ||
try { | ||
const responseData = await this.pool.request({ | ||
const requestOptions = { | ||
method: request.method, | ||
@@ -143,3 +143,10 @@ origin: request.origin, | ||
signal: request.signal, | ||
}); | ||
}; | ||
if (request.json === true) { | ||
if (requestOptions.headers['content-type'] === undefined) { | ||
requestOptions.headers['content-type'] = 'application/json; charset=utf-8'; | ||
} | ||
requestOptions.body = JSON.stringify(requestOptions.body); | ||
} | ||
const responseData = await this.pool.request(requestOptions); | ||
responseData.body.setEncoding('utf8'); | ||
@@ -146,0 +153,0 @@ let data = ''; |
{ | ||
"name": "apollo-datasource-http", | ||
"version": "0.15.0", | ||
"version": "0.16.0", | ||
"author": "Dustin Deus <deusdustin@gmail.com>", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -139,4 +139,4 @@ # Apollo HTTP Data Source | ||
# Node.js support | ||
## Node.js support | ||
We test this software against **latest** major releases of the [Node.js LTS policy](https://github.com/nodejs/Release). `Current` is included to catch regression earlier. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33036
330