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

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

Instances

data Version Source

Supported HTTP versions

Constructors

Http10 
Http11 

data Method Source

All known HTTP methods

Constructors

GET 
POST 
PUT 
DELETE 
TRACE 
CONNECT 
HEAD 

FieldList related functions

fromList :: [(String, String)] -> FieldListSource

Creates a FieldList type from a list.

singleton :: (String, String) -> FieldListSource

Creates a FieldList out from a single element.

empty :: FieldListSource

Returns an empty fieldlist.

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

Transforms a fieldlist into a list type.

parseQString :: String -> FieldListSource

Parse a query string.

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

Find keys that satisfy a given predicate.

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

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 -> StringSource

Same as findWithDefault but the match is case-insenstiive.

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

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

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

Inserts a new value into a fieldlist.

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

Inserts or updates occurrences of a given key.

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

Same as replace but work on a list type

union :: FieldList -> FieldList -> FieldListSource

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

unionAll :: FieldList -> FieldList -> FieldListSource

Combines two fieldsets keeping duplicates.

Request related functions

showURL :: Request -> StringSource

Show the URL.

showQString :: Request -> StringSource

Show the querty string of the URL.

showProtocol :: Request -> StringSource

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

showAuthority :: Request -> StringSource

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 -> StringSource

Show the path component of the URL.

parseURL :: String -> Maybe RequestSource

Parse a URL and creates an request type.