bugsnag-types-1.1.0.1: src/Data/Bugsnag/Types/Request.hs
module Data.Bugsnag.Types.Request
( Request (..)
, exampleRequest
) where
import Data.Bugsnag.Types.Prelude
-- | Details about the web request from the client that experienced the
-- error, if relevant. To display custom request data alongside these
-- standard fields on the dashboard, the custom data should be included in
-- the @metaData@ object in a @request@ object.
data Request = Request
{ clientIp :: Maybe Text
-- ^ The IP address of the client that experienced the error.
, headers :: Maybe (KeyMap Text)
-- ^ The headers sent with the request.
--
-- > {
-- > "Accept": "*/*",
-- > "Accept-Encoding": "gzip, deflate, sdch, br",
-- > "Accept-Language": "en-US,en;q=0.8"
-- > }
, httpMethod :: Maybe Text
-- ^ The HTTP method used.
, url :: Maybe Text
-- ^ The URL of the request.
, referer :: Maybe Text
-- ^ The <https://en.wikipedia.org/wiki/HTTP_referer HTTP referer>
}
deriving stock (Eq, Show, Generic)
instance FromJSON Request where
parseJSON = genericParseJSON aesonOptions
instance ToJSON Request where
toJSON = genericToJSON aesonOptions
toEncoding = genericToEncoding aesonOptions
exampleRequest :: Request
exampleRequest = Request
{ clientIp = Just "192.168.44.0"
, headers = Nothing
, httpMethod = Just "PUT"
, url = Just "http://example.com/users/19/settings"
, referer = Just "http://example.com?q=awesome"
}