Skip to content

Commit

Permalink
chore(url): mention toDecode param in docs (#168)
Browse files Browse the repository at this point in the history
* Update readme parse() section for URL decoding

* Update readme.md

Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>

Co-authored-by: SelvarajKarupusamy <selvaraj.karuppusamy@getsimpl.com>
Co-authored-by: Luke Edwards <luke.edwards05@gmail.com>
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
  • Loading branch information
4 people authored Aug 11, 2021
1 parent e0e131d commit 4885177
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,22 @@ You may also pass a sub-application, which _must_ be accompanied by a `base` pat
Please see [`Middleware`](#middleware) and [Express' middleware examples](http://expressjs.com/en/4x/api.html#middleware-callback-function-examples) for more info.


### parse(req)
### parse(req, toDecode=true)

Returns: `Object` or `undefined`

As of `v0.5.0`, this is an alias of the [`@polka/url`](/packages/url) module. For nearly all cases, you'll notice no changes.

One important difference is that URL decoding is enabled by default in polka but it is disabled by default in the `@polka/url` module. You can disable the URL decoding if required,

```js
const app = polka();
const { parse } = require('@polka/url');
app.parse = (req, toDecode) => {
return parse(req, false); // or simply, return parse(req);
}
```

But, for whatever reason, you can quickly swap in [`parseurl`](https://github.com/pillarjs/parseurl) again:

```js
Expand All @@ -140,6 +150,8 @@ app.parse = require('parseurl');
//=> Done!
```

> **Note:** `parseurl` doesn't support URL decoding yet.
### listen()

Returns: `Polka`
Expand Down

0 comments on commit 4885177

Please sign in to comment.