Skip to content

Commit

Permalink
Adding support for URLSearchParams in node (#1900)
Browse files Browse the repository at this point in the history
* Adding support for URLSearchParams in node

* Remove un-needed code

* Update utils.js

* Make changes as suggested

Co-authored-by: Kamil Posiadala <kamil.posiadala@codecentric.de>
Co-authored-by: Jay <jasonsaayman@gmail.com>
  • Loading branch information
3 people committed Jun 25, 2020
1 parent bed6783 commit c4300a8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Expand Up @@ -726,6 +726,14 @@ const querystring = require('querystring');
axios.post('http://something.com/', querystring.stringify({ foo: 'bar' }));
```

or ['URLSearchParams'](https://nodejs.org/api/url.html#url_class_urlsearchparams) from ['url module'](https://nodejs.org/api/url.html) as follows:

```js
const url = require('url');
const params = new url.URLSearchParams({ foo: 'bar' });
axios.post('http://something.com/', params.toString());
```

You can also use the [`qs`](https://github.com/ljharb/qs) library.

###### NOTE
Expand Down

0 comments on commit c4300a8

Please sign in to comment.