← all modules
Sky.Core.Http
Sky.Core.Http
Sky.Core.Http — HTTP client (Layer 3 Sky source).
Types
type alias HttpResponse
type alias HttpRequest
Values
defaultRequest : String -> HttpRequest
`defaultRequest url` — a GET to `url`, no headers, no body,
get : String -> Task Error HttpResponse
`get url` — issue a GET request.
parseQuery : String -> Dict String String
`parseQuery raw` — parse a URL query string (`"a=1&b=2"`)
post : String -> String -> Task Error HttpResponse
`post url body` — issue a POST request with the given body
request : HttpRequest -> Task Error HttpResponse
`request req` — issue an HTTP request with full control over
withBody : String -> HttpRequest -> HttpRequest
`withBody body req` — replace the request body.
withFollowRedirects : Bool -> HttpRequest -> HttpRequest
`withFollowRedirects b req` — toggle automatic redirect
`withHeader name value req` — prepend a (case-preserving)
withMaxRedirects : Int -> HttpRequest -> HttpRequest
`withMaxRedirects n req` — cap the redirect chain length.
withMethod : String -> HttpRequest -> HttpRequest
`withMethod "POST" req` — replace the method.
withTimeout : Int -> HttpRequest -> HttpRequest
`withTimeout ms req` — replace the per-request timeout
withUrl : String -> HttpRequest -> HttpRequest
`withUrl url req` — replace the request URL. Useful when