Skip to content

Commit

Permalink
delete not_found
Browse files Browse the repository at this point in the history
not_found is kind of pointless and doesn’t save that much effort. it’s
probably better to simplify the API of spirit.node
  • Loading branch information
hnry committed Jul 15, 2016
1 parent a44e3c7 commit 07528b7
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 54 deletions.
1 change: 0 additions & 1 deletion docs/api/README.md
Expand Up @@ -15,7 +15,6 @@ When using the node http adapter (`spirit.node`) be sure to become familiar with
* [file_response](node.md#file_response)
* [err_response](node.md#err_response)
* [redirect](node.md#redirect)
* [not_found](node.md#not_found)
* [Response](Response.md)

* utils
Expand Down
22 changes: 0 additions & 22 deletions docs/api/node.md
Expand Up @@ -158,28 +158,6 @@ redirect(301, "http://www.google.com")
-------------------------------------------


# not_found
##### (spirit.node.not_found)

Returns a [Response](Response.md) with a 404 status code and `body` as it's body.

Example:
```js
not_found("sorry, the page wasn't found")
```

[Source: src/http/response.js (not_found)](../../src/http/response.js#L135)

#### Arguments
* body {undefined|string|buffer|stream} the body of the response

#### Return
{Response}


-------------------------------------------


# err_response
##### (spirit.node.err_response)

Expand Down
18 changes: 0 additions & 18 deletions spec/http/response-spec.js
Expand Up @@ -156,24 +156,6 @@ describe("http.response", () => {
})
})

describe("not_found", () => {
it("returns a response map with 404 status", () => {
expect(response.not_found("hi")).toEqual(jasmine.objectContaining({
status: 404,
headers: {
"Content-Length": 2
},
body: "hi"
}))

expect(response.not_found()).toEqual(jasmine.objectContaining({
status: 404,
headers: {},
body: undefined
}))
})
})

describe("err_response", () => {
it("returns a response map with status 500", () => {
expect(response.err_response("test 123")).toEqual(jasmine.objectContaining({
Expand Down
13 changes: 0 additions & 13 deletions src/http/response.js
Expand Up @@ -134,18 +134,6 @@ const redirect = (status, url) => {
.location(url)
}

/**
* returns a 404 Response with `body`
*
* @param {*} body - the body of a response-map
* @return {Response}
*/
const not_found = (body) => {
return new Response(body)
.status_(404)
.len(size_of(body))
}

/**
* returns a 500 Response with `err`
*
Expand Down Expand Up @@ -173,6 +161,5 @@ module.exports = {
response,
file_response,
redirect,
not_found,
err_response
}

0 comments on commit 07528b7

Please sign in to comment.