Skip to content
Myr

Fix minor typos and improve backtick consistency (#853)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Rohit Nair P · committed by GitHub · parent d375014 · Browse files · 4 files+15 added−15 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+15 added−15 removed

  • other:+15 added−15 removed

4 files+15 added−15 removed

modified:source/core/Ky.ts+1 added-1 removed
216 unmodified lines
217218 let processedError: Error = error;219 for (const hook of ky.#options.hooks.beforeError) {220 // `request` is the current failing request. `options` intentionally remains the221 // stable normalized Ky options snapshot for the same reason as HTTPError above.221 // stable normalized Ky options snapshot for the same reason as `HTTPError` above.222 // eslint-disable-next-line no-await-in-loop223 const hookResult: unknown = await hook({224 request: ky.request,225 options: ky.#getNormalizedOptions(),
756 unmodified lines
modified:source/types/options.ts+2 added-2 removed
111 unmodified lines
112113 /**114 A base URL to [resolve](https://developer.mozilla.org/en-US/docs/Web/API/URL_API/Resolving_relative_references) the `input` against. When the `input` (after applying the `prefix` option) is only a relative URL, such as `'users'`, `'/users'`, or `'//my-site.com'`, it will be resolved against the `baseUrl` to determine the destination of the request. Otherwise, the `input` is absolute, such as `'https://my-site.com'`, and it will bypass the `baseUrl`.115116 Useful when used with [`ky.extend()`](#kyextenddefaultoptions) to create niche-specific Ky-instances.116 Useful when used with [`ky.extend()`](#kyextenddefaultoptions) to create niche-specific Ky instances.117118 If the `baseUrl` itself is relative, it will be resolved against the environment's base URL, such as [`document.baseURI`](https://developer.mozilla.org/en-US/docs/Web/API/Node/baseURI) in browsers or `location.href` in Deno (see the `--location` flag).119120 **Tip:** When setting a `baseUrl` that has a path, we recommend that it include a trailing slash `/`, as in `'/api/'` rather than `/api`. This ensures more intuitive behavior for page-relative `input` URLs, such as `'users'` or `'./users'`, where they will _extend_ from the full path of the `baseUrl` rather than _replacing_ its last path segment.
15 unmodified lines
136137 /**138 A prefix to prepend to the `input` before making the request (and before it is resolved against the `baseUrl`). It can be any valid path or URL, either relative or absolute. A trailing slash `/` is optional and will be added automatically, if needed, when it is joined with `input`. Only takes effect when `input` is a string.139140 Useful when used with [`ky.extend()`](#kyextenddefaultoptions) to create niche-specific Ky-instances.140 Useful when used with [`ky.extend()`](#kyextenddefaultoptions) to create niche-specific Ky instances.141142 *In most cases, you should use the `baseUrl` option instead, as it is more consistent with web standards. However, `prefix` is useful if you want origin-relative `input` URLs, such as `/users`, to be treated as if they were page-relative. In other words, the leading slash of the `input` will essentially be ignored, because the `prefix` will become part of the `input` before URL resolution happens.*143144 Notes:
321 unmodified lines
modified:source/utils/type-guards.ts+9 added-9 removed
modified:readme.md+3 added-3 removed
220 unmodified lines
221Type: `string | URL`222223A base URL to [resolve](https://developer.mozilla.org/en-US/docs/Web/API/URL_API/Resolving_relative_references) the `input` against. When the `input` (after applying the `prefix` option) is only a relative URL, such as `'users'`, `'/users'`, or `'//my-site.com'`, it will be resolved against the `baseUrl` to determine the destination of the request. Otherwise, the `input` is absolute, such as `'https://my-site.com'`, and it will bypass the `baseUrl`.224225Useful when used with [`ky.extend()`](#kyextenddefaultoptions) to create niche-specific Ky-instances.225Useful when used with [`ky.extend()`](#kyextenddefaultoptions) to create niche-specific Ky instances.226227If the `baseUrl` itself is relative, it will be resolved against the environment's base URL, such as [`document.baseURI`](https://developer.mozilla.org/en-US/docs/Web/API/Node/baseURI) in browsers or `location.href` in Deno (see the `--location` flag).228229**Tip:** When setting a `baseUrl` that has a path, we recommend that it include a trailing slash `/`, as in `'/api/'` rather than `/api`. This ensures more intuitive behavior for page-relative `input` URLs, such as `'users'` or `'./users'`, where they will _extend_ from the full path of the `baseUrl` rather than _replacing_ its last path segment.
15 unmodified lines
245Type: `string | URL`246247A prefix to prepend to the `input` before making the request (and before it is resolved against the `baseUrl`). It can be any valid path or URL, either relative or absolute. A trailing slash `/` is optional and will be added automatically, if needed, when it is joined with `input`. Only takes effect when `input` is a string.248249Useful when used with [`ky.extend()`](#kyextenddefaultoptions) to create niche-specific Ky-instances.249Useful when used with [`ky.extend()`](#kyextenddefaultoptions) to create niche-specific Ky instances.250251*In most cases, you should use the `baseUrl` option instead, as it is more consistent with web standards. However, `prefix` is useful if you want origin-relative `input` URLs, such as `/users`, to be treated as if they were page-relative. In other words, the leading slash of the `input` will essentially be ignored, because the `prefix` will become part of the `input` before URL resolution happens.*252253```js
802 unmodified lines
1056 ]1057 }1058};10591060// Note that response will be `undefined` in case `ky.stop` is returned.1060// Note that `response` will be `undefined` in case `ky.stop` is returned.1061const response = await ky.post('https://example.com', options);10621063// Using `.text()` or other body methods is not supported.1064const text = await ky('https://example.com', options).text();
610 unmodified lines