Skip to content

Commit 9a781e4

Browse files
committed
Add status code and message
1 parent 2fb1e83 commit 9a781e4

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

docs/Node/HTTP/Client.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,20 @@ responseHeaders :: Response -> StrMap String
133133

134134
Get the response headers as a hash
135135

136+
#### `statusCode`
137+
138+
``` purescript
139+
statusCode :: Response -> Int
140+
```
141+
142+
Get the response status code
143+
144+
#### `statusMessage`
145+
146+
``` purescript
147+
statusMessage :: Response -> String
148+
```
149+
150+
Get the response status message
151+
136152

src/Node/HTTP/Client.purs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ module Node.HTTP.Client
1717
, responseAsStream
1818
, httpVersion
1919
, responseHeaders
20+
, statusCode
21+
, statusMessage
2022
) where
2123

2224
import Prelude
@@ -96,3 +98,11 @@ httpVersion = _.httpVersion <<< unsafeCoerce
9698
-- | Get the response headers as a hash
9799
responseHeaders :: Response -> StrMap String
98100
responseHeaders = _.headers <<< unsafeCoerce
101+
102+
-- | Get the response status code
103+
statusCode :: Response -> Int
104+
statusCode = _.statusCode <<< unsafeCoerce
105+
106+
-- | Get the response status message
107+
statusMessage :: Response -> String
108+
statusMessage = _.statusMessage <<< unsafeCoerce

0 commit comments

Comments
 (0)