packages feed

extism-pdk-0.1.0.0: examples/HTTPGet.hs

module HTTPGet where

import Extism.PDK
import Extism.PDK.HTTP

httpGet = do
  -- Get URL from the host
  url <- input
  -- Create a new 'Request'
  let req = newRequest url
  -- Send the request, get a 'Response'
  res <- sendRequest req Nothing
  -- Save response body to memory
  outputMemory (memory res)

foreign export ccall "http_get" httpGet ::  IO ()