hoauth-0.2.3: A Haskell implementation of OAuth 1.0a protocol.Source codeContentsIndex
Network.OAuth.Http.Request
Contents
Types
FieldList related functions
Request related functions
Description
The request currently is only able to represent an HTTP request.
Synopsis
data Request = ReqHttp {
version :: Version
ssl :: Bool
host :: String
port :: Int
method :: Method
reqHeaders :: FieldList
pathComps :: [String]
qString :: FieldList
reqPayload :: ByteString
}
data FieldList
data Version
= Http10
| Http11
data Method
= GET
| POST
| PUT
| DELETE
| TRACE
| CONNECT
| HEAD
fromList :: [(String, String)] -> FieldList
singleton :: (String, String) -> FieldList
empty :: FieldList
toList :: FieldList -> [(String, String)]
parseQString :: String -> FieldList
find :: (String -> Bool) -> FieldList -> [String]
findWithDefault :: (String, String) -> FieldList -> String
ifindWithDefault :: (String, String) -> FieldList -> String
change :: (String, String) -> FieldList -> FieldList
insert :: (String, String) -> FieldList -> FieldList
replace :: (String, String) -> FieldList -> FieldList
replaces :: [(String, String)] -> FieldList -> FieldList
union :: FieldList -> FieldList -> FieldList
unionAll :: FieldList -> FieldList -> FieldList
showURL :: Request -> String
showQString :: Request -> String
showProtocol :: Request -> String
showAuthority :: Request -> String
showPath :: Request -> String
parseURL :: String -> Maybe Request
Types
data Request Source
Constructors
ReqHttp
version :: VersionProtocol version
ssl :: BoolWheter or not to use ssl
host :: StringThe hostname to connect to
port :: IntThe port to connect to
method :: MethodThe HTTP method of the request.
reqHeaders :: FieldListRequest headers
pathComps :: [String]The path split into components
qString :: FieldListThe query string, usually set for GET requests
reqPayload :: ByteStringThe message body
data FieldList Source
Key-value list.
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.
Produced by Haddock version 2.6.0