From 4ce7c7214b64e55e33aa6e870c9696d96c8da982 Mon Sep 17 00:00:00 2001 From: Glandos Date: Wed, 2 Mar 2022 16:14:04 +0100 Subject: [PATCH] fix(useFetch): uppercase HTTP methods in useFetch (#1336) Co-authored-by: Nurettin Kaya --- packages/core/useFetch/index.ts | 18 +++++++++--------- packages/core/useStyleTag/index.md | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/core/useFetch/index.ts b/packages/core/useFetch/index.ts index 68af4bce114..04d058726aa 100644 --- a/packages/core/useFetch/index.ts +++ b/packages/core/useFetch/index.ts @@ -89,7 +89,7 @@ export interface UseFetchReturn { } type DataType = 'text' | 'json' | 'blob' | 'arrayBuffer' | 'formData' -type HttpMethod = 'get' | 'post' | 'put' | 'delete' | 'patch' | 'head' | 'options' +type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' const payloadMapping: Record = { json: 'application/json', @@ -265,7 +265,7 @@ export function useFetch(url: MaybeRef, ...args: any[]): UseFetchRetu let options: UseFetchOptions = { immediate: true, refetch: false, timeout: 0 } interface InternalConfig { method: HttpMethod; type: DataType; payload: unknown; payloadType?: string } const config: InternalConfig = { - method: 'get', + method: 'GET', type: 'text' as DataType, payload: undefined as unknown, } @@ -442,13 +442,13 @@ export function useFetch(url: MaybeRef, ...args: any[]): UseFetchRetu onFetchError: errorEvent.on, onFetchFinally: finallyEvent.on, // method - get: setMethod('get'), - put: setMethod('put'), - post: setMethod('post'), - delete: setMethod('delete'), - patch: setMethod('patch'), - head: setMethod('head'), - options: setMethod('options'), + get: setMethod('GET'), + put: setMethod('PUT'), + post: setMethod('POST'), + delete: setMethod('DELETE'), + patch: setMethod('PATCH'), + head: setMethod('HEAD'), + options: setMethod('OPTIONS'), // type json: setType('json'), text: setType('text'), diff --git a/packages/core/useStyleTag/index.md b/packages/core/useStyleTag/index.md index 4eb8d488b49..13453fcf341 100644 --- a/packages/core/useStyleTag/index.md +++ b/packages/core/useStyleTag/index.md @@ -47,7 +47,7 @@ useStyleTag('.foo { margin-top: 32px; }', { id: 'custom-id' }) ```html ``` @@ -62,6 +62,6 @@ useStyleTag('.foo { margin-top: 32px; }', { media: 'print' }) ```html ```