mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-28 14:23:04 +03:00
Add Response.withHeaders for adding more than one header at once.
This commit is contained in:
parent
9f788d8aba
commit
032c710c74
@ -4,7 +4,7 @@ module Server.Response exposing
|
||||
, emptyBody, body, bytesBody, base64Body
|
||||
, render
|
||||
, map
|
||||
, withHeader, withStatusCode, withSetCookieHeader
|
||||
, withHeader, withHeaders, withStatusCode, withSetCookieHeader
|
||||
, toJson
|
||||
)
|
||||
|
||||
@ -49,7 +49,7 @@ You can use `withHeader` and `withStatusCode` to customize either type of Respon
|
||||
|
||||
## Amending Responses
|
||||
|
||||
@docs withHeader, withStatusCode, withSetCookieHeader
|
||||
@docs withHeader, withHeaders, withStatusCode, withSetCookieHeader
|
||||
|
||||
|
||||
## Internals
|
||||
@ -228,6 +228,17 @@ withHeader name value serverResponse =
|
||||
ServerResponse { response | headers = ( name, value ) :: response.headers }
|
||||
|
||||
|
||||
{-| -}
|
||||
withHeaders : List ( String, String ) -> Response data -> Response data
|
||||
withHeaders headers serverResponse =
|
||||
case serverResponse of
|
||||
RenderPage response data ->
|
||||
RenderPage { response | headers = headers ++ response.headers } data
|
||||
|
||||
ServerResponse response ->
|
||||
ServerResponse { response | headers = headers ++ response.headers }
|
||||
|
||||
|
||||
{-| -}
|
||||
withSetCookieHeader : SetCookie -> Response data -> Response data
|
||||
withSetCookieHeader cookie response =
|
||||
|
Loading…
Reference in New Issue
Block a user