From 6634e3bb761377d70a22d0fdbfb0c2519abfff7f Mon Sep 17 00:00:00 2001 From: David Sanders Date: Sun, 30 Aug 2020 11:50:56 -0700 Subject: [PATCH] fix: use qs to serialize form data in browser Unifies behavior for Node and browser with regards to 'application/x-www-form-urlencoded' --- src/client.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/client.js b/src/client.js index 84a555294..f3960bf3f 100644 --- a/src/client.js +++ b/src/client.js @@ -19,6 +19,7 @@ if (typeof window !== 'undefined') { const Emitter = require('component-emitter'); const safeStringify = require('fast-safe-stringify'); +const qs = require('qs'); const RequestBase = require('./request-base'); const isObject = require('./is-object'); const ResponseBase = require('./response-base'); @@ -213,7 +214,7 @@ request.types = { */ request.serialize = { - 'application/x-www-form-urlencoded': serialize, + 'application/x-www-form-urlencoded': qs.stringify, 'application/json': safeStringify };