got 11.8.3 → 11.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -113,11 +113,11 @@ function asPromise(normalizedOptions) {
|
|
|
113
113
|
request._beforeError(new types_1.RequestError(error.message, error, request));
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
|
+
globalResponse = response;
|
|
116
117
|
if (!is_response_ok_1.isResponseOk(response)) {
|
|
117
118
|
request._beforeError(new types_1.HTTPError(response));
|
|
118
119
|
return;
|
|
119
120
|
}
|
|
120
|
-
globalResponse = response;
|
|
121
121
|
resolve(request.options.resolveBodyOnly ? response.body : response);
|
|
122
122
|
});
|
|
123
123
|
const onError = (error) => {
|
|
@@ -866,6 +866,14 @@ class Request extends stream_1.Duplex {
|
|
|
866
866
|
const redirectUrl = new url_1.URL(redirectBuffer, url);
|
|
867
867
|
const redirectString = redirectUrl.toString();
|
|
868
868
|
decodeURI(redirectString);
|
|
869
|
+
// eslint-disable-next-line no-inner-declarations
|
|
870
|
+
function isUnixSocketURL(url) {
|
|
871
|
+
return url.protocol === 'unix:' || url.hostname === 'unix';
|
|
872
|
+
}
|
|
873
|
+
if (!isUnixSocketURL(url) && isUnixSocketURL(redirectUrl)) {
|
|
874
|
+
this._beforeError(new RequestError('Cannot redirect to UNIX socket', {}, this));
|
|
875
|
+
return;
|
|
876
|
+
}
|
|
869
877
|
// Redirecting to a different site, clear sensitive data.
|
|
870
878
|
if (redirectUrl.hostname !== url.hostname || redirectUrl.port !== url.port) {
|
|
871
879
|
if ('host' in options.headers) {
|
package/dist/source/types.d.ts
CHANGED
|
@@ -90,6 +90,14 @@ export declare type OptionsWithPagination<T = unknown, R = unknown> = Merge<Opti
|
|
|
90
90
|
An instance of `got.paginate`.
|
|
91
91
|
*/
|
|
92
92
|
export interface GotPaginate {
|
|
93
|
+
/**
|
|
94
|
+
Same as `GotPaginate.each`.
|
|
95
|
+
*/
|
|
96
|
+
<T, R = unknown>(url: string | URL, options?: OptionsWithPagination<T, R>): AsyncIterableIterator<T>;
|
|
97
|
+
/**
|
|
98
|
+
Same as `GotPaginate.each`.
|
|
99
|
+
*/
|
|
100
|
+
<T, R = unknown>(options?: OptionsWithPagination<T, R>): AsyncIterableIterator<T>;
|
|
93
101
|
/**
|
|
94
102
|
Returns an async iterator.
|
|
95
103
|
|
|
@@ -133,14 +141,6 @@ export interface GotPaginate {
|
|
|
133
141
|
```
|
|
134
142
|
*/
|
|
135
143
|
all: (<T, R = unknown>(url: string | URL, options?: OptionsWithPagination<T, R>) => Promise<T[]>) & (<T, R = unknown>(options?: OptionsWithPagination<T, R>) => Promise<T[]>);
|
|
136
|
-
/**
|
|
137
|
-
Same as `GotPaginate.each`.
|
|
138
|
-
*/
|
|
139
|
-
<T, R = unknown>(url: string | URL, options?: OptionsWithPagination<T, R>): AsyncIterableIterator<T>;
|
|
140
|
-
/**
|
|
141
|
-
Same as `GotPaginate.each`.
|
|
142
|
-
*/
|
|
143
|
-
<T, R = unknown>(options?: OptionsWithPagination<T, R>): AsyncIterableIterator<T>;
|
|
144
144
|
}
|
|
145
145
|
export interface GotRequestFunction {
|
|
146
146
|
(url: string | URL, options?: OptionsOfTextResponseBody): CancelableRequest<Response<string>>;
|