Skip to content

Commit

Permalink
[#3] Location type error (#5)
Browse files Browse the repository at this point in the history
* fix: missing location method type
* feat: add res.location usage example
* feat: update API docs pointer out use of res.location()
* feat: changelog + version bump
  • Loading branch information
asos-craigmorten authored May 27, 2020
1 parent 58250f5 commit 49df5cb
Show file tree
Hide file tree
Showing 56 changed files with 604 additions and 489 deletions.
8 changes: 8 additions & 0 deletions .github/API/response.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,14 @@ A `path` value of "back" has a special meaning, it refers to the URL specified i
>
> Browsers take the responsibility of deriving the intended URL from the current URL or the referring URL, and the URL specified in the `Location` header; and redirect the user accordingly.
**Note:** If you wish to perform a redirect using `res.location()`, you will also need to manually send the request. This method only sets the `Location` header. To perform a redirect alongside this method use `res.sendStatus()`. For example:

```ts
app.get("/redirect", function (req, res, next) {
res.location("/home").sendStatus(301);
});
```

#### res.send([body])

Sends the HTTP response.
Expand Down
6 changes: 6 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# ChangeLog

## [0.5.1] - 27-05-2020

- fix: missing location method type
- feat: add res.location usage example
- feat: update API docs pointer out use of res.location()

## [0.5.0] - 27-05-2020

- fix: major bug with the body parsers. `req.body` is protected in Deno and thus cannot overwrite. We _could_ look to use a proxy like method in the future. For now we populate `req.parsedBody` instead.
Expand Down
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ lock:
precommit:
@make typedoc
@make fmt
@make fmt
@make fmt
@make lock

test:
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/js/search.json

Large diffs are not rendered by default.

50 changes: 25 additions & 25 deletions docs/classes/_response_.response.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ <h3>app</h3>
<div class="tsd-signature tsd-kind-icon">app<span class="tsd-signature-symbol">:</span> <a href="../interfaces/_types_.application.html" class="tsd-signature-type">Application</a></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/3d85648/src/response.ts#L32">response.ts:32</a></li>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/8c21e1b/src/response.ts#L32">response.ts:32</a></li>
</ul>
</aside>
</section>
Expand All @@ -148,7 +148,7 @@ <h3>body</h3>
<div class="tsd-signature tsd-kind-icon">body<span class="tsd-signature-symbol">:</span> <a href="../modules/_types_.html#denoresponsebody" class="tsd-signature-type">DenoResponseBody</a></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/3d85648/src/response.ts#L31">response.ts:31</a></li>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/8c21e1b/src/response.ts#L31">response.ts:31</a></li>
</ul>
</aside>
</section>
Expand All @@ -158,7 +158,7 @@ <h3>headers</h3>
<div class="tsd-signature tsd-kind-icon">headers<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Headers</span><span class="tsd-signature-symbol"> = new Headers()</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/3d85648/src/response.ts#L30">response.ts:30</a></li>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/8c21e1b/src/response.ts#L30">response.ts:30</a></li>
</ul>
</aside>
</section>
Expand All @@ -168,7 +168,7 @@ <h3>locals</h3>
<div class="tsd-signature tsd-kind-icon">locals<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/3d85648/src/response.ts#L34">response.ts:34</a></li>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/8c21e1b/src/response.ts#L34">response.ts:34</a></li>
</ul>
</aside>
</section>
Expand All @@ -178,7 +178,7 @@ <h3>req</h3>
<div class="tsd-signature tsd-kind-icon">req<span class="tsd-signature-symbol">:</span> <a href="../interfaces/_types_.request.html" class="tsd-signature-type">Request</a></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/3d85648/src/response.ts#L33">response.ts:33</a></li>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/8c21e1b/src/response.ts#L33">response.ts:33</a></li>
</ul>
</aside>
</section>
Expand All @@ -188,7 +188,7 @@ <h3>status</h3>
<div class="tsd-signature tsd-kind-icon">status<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Status</span><span class="tsd-signature-symbol"> = 200</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/3d85648/src/response.ts#L29">response.ts:29</a></li>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/8c21e1b/src/response.ts#L29">response.ts:29</a></li>
</ul>
</aside>
</section>
Expand All @@ -205,7 +205,7 @@ <h3>append</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/3d85648/src/response.ts#L49">response.ts:49</a></li>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/8c21e1b/src/response.ts#L49">response.ts:49</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -240,7 +240,7 @@ <h3>attachment</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/3d85648/src/response.ts#L62">response.ts:62</a></li>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/8c21e1b/src/response.ts#L62">response.ts:62</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -269,7 +269,7 @@ <h3>clear<wbr>Cookie</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/3d85648/src/response.ts#L101">response.ts:101</a></li>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/8c21e1b/src/response.ts#L101">response.ts:101</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -298,7 +298,7 @@ <h3>cookie</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/3d85648/src/response.ts#L84">response.ts:84</a></li>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/8c21e1b/src/response.ts#L84">response.ts:84</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -330,7 +330,7 @@ <h3>download</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/3d85648/src/response.ts#L124">response.ts:124</a></li>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/8c21e1b/src/response.ts#L124">response.ts:124</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -366,7 +366,7 @@ <h3>end</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/3d85648/src/response.ts#L149">response.ts:149</a></li>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/8c21e1b/src/response.ts#L149">response.ts:149</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -394,7 +394,7 @@ <h3>etag</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/3d85648/src/response.ts#L166">response.ts:166</a></li>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/8c21e1b/src/response.ts#L166">response.ts:166</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -427,7 +427,7 @@ <h3>get</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/3d85648/src/response.ts#L189">response.ts:189</a></li>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/8c21e1b/src/response.ts#L189">response.ts:189</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -456,7 +456,7 @@ <h3>json</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/3d85648/src/response.ts#L205">response.ts:205</a></li>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/8c21e1b/src/response.ts#L205">response.ts:205</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -488,7 +488,7 @@ <h3>jsonp</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/3d85648/src/response.ts#L231">response.ts:231</a></li>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/8c21e1b/src/response.ts#L231">response.ts:231</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -520,7 +520,7 @@ <h3>links</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/3d85648/src/response.ts#L281">response.ts:281</a></li>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/8c21e1b/src/response.ts#L281">response.ts:281</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -554,7 +554,7 @@ <h3>location</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/3d85648/src/response.ts#L311">response.ts:311</a></li>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/8c21e1b/src/response.ts#L311">response.ts:311</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -589,7 +589,7 @@ <h3>send</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/3d85648/src/response.ts#L334">response.ts:334</a></li>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/8c21e1b/src/response.ts#L334">response.ts:334</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -621,7 +621,7 @@ <h3>send<wbr>File</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/3d85648/src/response.ts#L401">response.ts:401</a></li>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/8c21e1b/src/response.ts#L401">response.ts:401</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -650,7 +650,7 @@ <h3>send<wbr>Status</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/3d85648/src/response.ts#L432">response.ts:432</a></li>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/8c21e1b/src/response.ts#L432">response.ts:432</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -684,7 +684,7 @@ <h3>set</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/3d85648/src/response.ts#L454">response.ts:454</a></li>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/8c21e1b/src/response.ts#L454">response.ts:454</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -719,7 +719,7 @@ <h3>set<wbr>Status</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/3d85648/src/response.ts#L476">response.ts:476</a></li>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/8c21e1b/src/response.ts#L476">response.ts:476</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -750,7 +750,7 @@ <h3>type</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/3d85648/src/response.ts#L497">response.ts:497</a></li>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/8c21e1b/src/response.ts#L497">response.ts:497</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -785,7 +785,7 @@ <h3>unset</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/3d85648/src/response.ts#L510">response.ts:510</a></li>
<li>Defined in <a href="https://github.com/asos-craigmorten/opine/blob/8c21e1b/src/response.ts#L510">response.ts:510</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down
Loading

0 comments on commit 49df5cb

Please sign in to comment.