extism-pdk-0.2.0.0: Extism Plugin Development Kit
Safe HaskellSafe-Inferred
LanguageHaskell2010

Extism.PDK.HTTP

Description

Contains bindings to the Extism PDK HTTP interface

Synopsis

Documentation

type Request = HTTPRequest Source #

HTTP Request

data Response Source #

HTTP Response

Constructors

Response 

Fields

withMethod :: String -> Request -> Request Source #

Update a Request with the provided HTTP request method (GET, POST, PUT, DELETE, ...)

withHeaders :: [(String, String)] -> Request -> Request Source #

Update a Request with the provided HTTP request headers

responseMemory :: Response -> Memory Source #

Access the Memory block associated with a Response

responseJSON :: JSON a => Response -> IO (Either String a) Source #

Get the Response body as JSON

response :: FromBytes a => Response -> IO (Either String a) Source #

Get the Response body and decode it

sendRequestWithBody :: ToBytes a => Request -> a -> IO Response Source #

Send HTTP request with an optional request body

sendRequest :: ToBytes a => Request -> Maybe a -> IO Response Source #

Send HTTP request with an optional request body