From 24eb6c8a075eda604e49b163bd0a25c22a1e712a Mon Sep 17 00:00:00 2001 From: David Bonnet Date: Mon, 18 Mar 2019 11:57:21 +0100 Subject: [PATCH] fix(queries): use provided route method if any --- src/queries.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/queries.js b/src/queries.js index 95fbe685..d91619a4 100644 --- a/src/queries.js +++ b/src/queries.js @@ -7,6 +7,7 @@ import { assign, pick, upperFirst, + lowerCase, } from 'lodash' import { compose, withPropsOnChange } from 'recompose' @@ -171,11 +172,13 @@ export function toFetchQuery(routes, transform = identity) { const { method = 'get' } = query const routeOrUrl = routes[query.type][method](query) const route = isString(routeOrUrl) ? { url: routeOrUrl } : routeOrUrl + const { method: fetchMethod = method } = route return next( transform( { - body: BODY_METHODS[method] && JSON.stringify(query.value), - method: method === 'list' ? 'GET' : upperCase(method), + body: + BODY_METHODS[lowerCase(fetchMethod)] && JSON.stringify(query.value), + method: fetchMethod === 'list' ? 'GET' : upperCase(fetchMethod), mode: 'cors', cache: 'no-store', signal: query.signal,