github
<a href="https://github.com/williamthome/zotonic-ls/commit/<a class=hub.com/williamthome/zotonic-ls/commit/<a class="double-link" href="https://git"><a class=hub.com/williamthome/zotonic-ls/commit/<a class="double-link" href="https://git"><a class=hub.com/williamthome/zotonic-ls/commit/b7306dcd6cfd924d34f4531c4d7ab5facac25355">b7306dcd6<a href="https://github.com/williamthome/zotonic-ls/commit/b7306dcd6cfd924d34f4531c4d7ab5facac25355">">&lt;a href=&quot;https://github.com/williamthome/zotonic-ls/commit/</a><a class="double-link" href="https://github.com/williamthome/zotonic-ls/commit/&lt;a class=&quot;double-link&quot; href=&quot;https://git">&lt;a class=</a>hub.com/williamthome/zotonic-ls/commit/b7306dcd6cfd924d34f4531c4d7ab5facac25355">b7306dcd6</a><a href="https://github.com/williamthome/zotonic-ls/commit/b7306dcd6cfd924d34f4531c4d7ab5facac25355">&lt;a href=&quot;https://github.com/williamthome/zotonic-ls/commit/b7306dcd6cfd924d34f4531c4d7ab5fa</a>cac25355">">Merge </a><a class="double-link" href="https://github.com/williamthome/zotonic-ls/commit/<a class="double-link" href="https://github.com/williamthome/zotonic-ls/commit/<a class="double-link" href="https://github.com/williamthome/zotonic-ls/commit/90cc3e3de27535e29d66b41ff9b9aa06816040c6">90cc3e3de</a><a href="https://github.com/williamthome/zotonic-ls/commit/b7306dcd6cfd924d34f4531c4d7ab5facac25355">&quot;&gt;90cc3e3de&lt;/a&gt;&quot;&gt;90cc3e3de&lt;/a&gt;&lt;a href=&quot;https://github.com/williamthome/zotonic-ls/commit/b7306dcd6cfd924d34f4531c4d7ab5facac25</a>355"> into </a><a class="double-link" href="https://github.com/williamthome/zotonic-ls/commit/<a class="double-link" href="https://github.com/williamthome/zotonic-ls/commit/3ef1d7a57">3ef1d7a57">3ef1d7a57</a>
68 of 106 branches covered (64.15%)
Branch coverage included in aggregate %.
467 of 1237 new or added lines in 46 files covered. (37.75%)
463 of 1237 relevant lines covered (37.43%)
2.61 hits per line
NEW
|
import { immutable } from '@/common/functional-programming'; |
|
NEW
|
|
× |
NEW
|
export type HttpMethod = 'POST' | 'GET' | 'PUT' | 'PATCH' | 'DELETE'; |
× |
NEW
|
|
× |
NEW
|
export interface HttpRequestOptions {
|
× |
NEW
|
method: HttpMethod;
|
× |
NEW
|
} |
× |
NEW
|
|
× |
NEW
|
export function buildHttpRequestArgs(args: {
|
× |
NEW
|
url: string; |
× |
NEW
|
options?: HttpRequestOptions; |
× |
NEW
|
}) { |
× |
NEW
|
return immutable({
|
× |
NEW
|
url: args.url,
|
× |
NEW
|
options: { |
× |
NEW
|
method: args.options?.method ?? ('GET' as HttpMethod), |
× |
NEW
|
}, |
× |
NEW
|
}); |
× |
NEW
|
} |
× |
NEW
|
|
× |
NEW
|
export type HttpRequestArgs = ReturnType<typeof buildHttpRequestArgs>;
|
× |
NEW
|
|
× |
NEW
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
× |
NEW
|
export type HttpRequest<T = any> = (
|
× |
NEW
|
args: Required<HttpRequestArgs>, |
× |
NEW
|
) => Promise<T | Error>; |
× |
NEW
|
|
× |
NEW
|
export type HttpRequestReturn<T> = ReturnType<HttpRequest<T>>;
|
× |