hoauth-0.3.5: A Haskell implementation of OAuth 1.0a protocol.

Safe HaskellNone
LanguageHaskell98

Network.OAuth.Http.Request

Contents

Description

The request currently is only able to represent an HTTP request.

Synopsis

Types

data Request Source

Constructors

ReqHttp 

Fields

version :: Version

Protocol version

ssl :: Bool

Wheter or not to use ssl

host :: String

The hostname to connect to

port :: Int

The port to connect to

method :: Method

The HTTP method of the request.

reqHeaders :: FieldList

Request headers

pathComps :: [String]

The path split into components

qString :: FieldList

The query string, usually set for GET requests

reqPayload :: ByteString

The message body (the first/only string part)

multipartPayload :: [FormDataPart]

The message body (i.e., for multipart/form-data)

data Version Source

Supported HTTP versions

Constructors

Http10 
Http11 

data Method Source

All known HTTP methods

Constructors

GET 
POST 
PUT 
DELETE 
TRACE 
CONNECT 
HEAD 

conversion of [FormDataPart] to curl's [HttpPost]

FieldList related functions

fromList :: [(String, String)] -> FieldList Source

Creates a FieldList type from a list.

singleton :: (String, String) -> FieldList Source

Creates a FieldList out from a single element.

empty :: FieldList Source

Returns an empty fieldlist.

toList :: FieldList -> [(String, String)] Source

Transforms a fieldlist into a list type.

parseQString :: String -> FieldList Source

Parse a query string.

find :: (String -> Bool) -> FieldList -> [String] Source

Find keys that satisfy a given predicate.

findWithDefault :: (String, String) -> FieldList -> String Source

Finds a the value defined in a fieldlist or returns a default value. In the event there are multiple values under the same key the first one is returned.

ifindWithDefault :: (String, String) -> FieldList -> String Source

Same as findWithDefault but the match is case-insenstiive.

change :: (String, String) -> FieldList -> FieldList Source

Updates all occurrences of a given key with a new value. Does nothing if the values does not exist.

insert :: (String, String) -> FieldList -> FieldList Source

Inserts a new value into a fieldlist.

replace :: (String, String) -> FieldList -> FieldList Source

Inserts or updates occurrences of a given key.

replaces :: [(String, String)] -> FieldList -> FieldList Source

Same as replace but work on a list type

union :: FieldList -> FieldList -> FieldList Source

Combines two fieldsets, but prefere items of the first list.

unionAll :: FieldList -> FieldList -> FieldList Source

Combines two fieldsets keeping duplicates.

Request related functions

showURL :: Request -> String Source

Show the URL.

showQString :: Request -> String Source

Show the querty string of the URL.

showProtocol :: Request -> String Source

Show the protocol in use (currently either https or http)

showAuthority :: Request -> String Source

Show the host+port path of the request. May return only the host when (ssl=False && port==80) or (ssl=True && port==443).

showPath :: Request -> String Source

Show the path component of the URL.

parseURL :: String -> Maybe Request Source

Parse a URL and creates an request type.