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

Fix type definitions for response headers #79

Merged
merged 3 commits into from
Apr 29, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @typedef Options
* @property {string} [url] the URL to request
* @property {'get'|'post'|'put'|'patch'|'delete'|'options'|'head'|'GET'|'POST'|'PUT'|'PATCH'|'DELETE'|'OPTIONS'|'HEAD'} [method="get"] HTTP method, case-insensitive
* @property {Headers} [headers] Request headers
* @property {RequestHeaders} [headers] Request headers
hdimitrov1 marked this conversation as resolved.
Show resolved Hide resolved
* @property {FormData|string|object} [body] a body, optionally encoded, to send
* @property {'text'|'json'|'stream'|'blob'|'arrayBuffer'|'formData'|'stream'} [responseType="json"] An encoding to use for the response
* @property {Record<string,any>|URLSearchParams} [params] querystring parameters
Expand All @@ -26,15 +26,15 @@
* @property {string} [xsrfCookieName] Pass an Cross-site Request Forgery prevention cookie value as a header defined by `xsrfHeaderName`
* @property {string} [xsrfHeaderName] The name of a header to use for passing XSRF cookies
* @property {(status: number) => boolean} [validateStatus] Override status code handling (default: 200-399 is a success)
* @property {Array<(body: any, headers: Headers) => any?>} [transformRequest] An array of transformations to apply to the outgoing request
* @property {Array<(body: any, headers: RequestHeaders) => any?>} [transformRequest] An array of transformations to apply to the outgoing request
* @property {string} [baseURL] a base URL from which to resolve all URLs
* @property {typeof window.fetch} [fetch] Custom window.fetch implementation
* @property {any} [data]
*/

/**
* @public
* @typedef Headers
* @typedef RequestHeaders
* @type {{[name: string]: string}}
*/

Expand Down Expand Up @@ -159,7 +159,7 @@ export default (function create(/** @type {Options} */ defaults) {
/** @type {Options} */
const options = deepMerge(defaults, config);

/** @type {Headers} */
/** @type {RequestHeaders} */
const customHeaders = {};

let data = _data || options.data;
Expand Down