Documentation ¶
Index ¶
- Constants
- func DeleteHTTPHeader(r *http.Request, headerNameToDelete string) error
- func FindHTTPHeader(r *http.Request, headerNameAsked string) (string, error)
- func PerformAverageHttpTest(test *AverageTest) (err error)
- func PerformSimpleHttpTest(test *SimpleTest) (err error)
- func ReceiveJSON(r *http.Request, receiver interface{}) (err error)
- func ReplyErrorInternal(w http.ResponseWriter, err error)
- func ReplyErrorWithCode(w http.ResponseWriter, httpStatusCode int, err error)
- func ReplyJSON(w http.ResponseWriter, replyObject interface{})
- func ReplyJSONFast(w http.ResponseWriter, replyObject interface{})
- func ReplyTextWithCode(w http.ResponseWriter, httpStatusCode int, replyText string)
- type AverageTest
- type AverageTestParameter
- type AverageTestResult
- type SimpleTest
- type SimpleTestParameter
- type SimpleTestResult
Constants ¶
const ( ErrHTTPHeaderNameIsNotSet = "HTTP Header Name is not set" ErrHTTPHeaderNameIsNotFound = "HTTP Header Name is not found" )
Errors
const (
ErrNotPointer = "not a pointer"
)
Errors.
const (
ErrNullPointer = "null pointer"
)
Errors.
Variables ¶
This section is empty.
Functions ¶
func DeleteHTTPHeader ¶
DeleteHTTPHeader Function tries to delete a Header from the HTTP Request.
func FindHTTPHeader ¶
FindHTTPHeader Function tries to find the HTTP Header with Name similar to the specified One. According to the Section 4.2 of RFC 2616, HTTP Header Names are Case insensitive. On Success, returns 'nil' and the exact Header Name which was found.
func PerformAverageHttpTest ¶
func PerformAverageHttpTest( test *AverageTest, ) (err error)
PerformAverageHttpTest Function performs the Simulation of an average HTTP Test Handler. Writes the received Results into the 'ResultReceived' Field of a Test Object.
func PerformSimpleHttpTest ¶
func PerformSimpleHttpTest( test *SimpleTest, ) (err error)
PerformSimpleHttpTest Function performs the Simulation of a simple HTTP Test Handler. Writes the received Results into the 'ResultReceived' Field of a Test Object.
func ReceiveJSON ¶
ReceiveJSON Function receives an Object encoded with JSON Format from the HTTP Request's Body.
func ReplyErrorInternal ¶
func ReplyErrorInternal( w http.ResponseWriter, err error, )
ReplyErrorInternal Function replies to the HTTP Request with an Error and 'Internal Server Error' HTTP Status Code.
func ReplyErrorWithCode ¶
func ReplyErrorWithCode( w http.ResponseWriter, httpStatusCode int, err error, )
ReplyErrorWithCode Function replies to the HTTP Request with an Error and the specified HTTP Status Code.
func ReplyJSON ¶
func ReplyJSON( w http.ResponseWriter, replyObject interface{}, )
ReplyJSON Function sends an Object in JSON Format to the HTTP Output Stream.
func ReplyJSONFast ¶
func ReplyJSONFast( w http.ResponseWriter, replyObject interface{}, )
ReplyJSONFast Function sends an Object in JSON Format to the HTTP Output Stream using the faster but less secure Way than an ordinary 'ReplyJSON' Method.
func ReplyTextWithCode ¶
func ReplyTextWithCode( w http.ResponseWriter, httpStatusCode int, replyText string, )
ReplyTextWithCode Function replies to the HTTP Request with the specified Text and HTTP Status Code.
Types ¶
type AverageTest ¶
type AverageTest struct { Parameter AverageTestParameter ResultExpected AverageTestResult ResultReceived AverageTestResult }
AverageTest Type is a Type of a average HTTP Test.
type AverageTestParameter ¶
type AverageTestParameter struct { RequestMethod string RequestUrl string RequestHeaders http.Header RequestBody io.Reader RequestHandler http.HandlerFunc }
AverageTestParameter Type is a Parameter of a average HTTP Test.
type AverageTestResult ¶
type AverageTestResult struct { ResponseStatusCode int ResponseHeaders http.Header ResponseBody []byte }
AverageTestResult Type is a Result of a average HTTP Test.
type SimpleTest ¶
type SimpleTest struct { Parameter SimpleTestParameter ResultExpected SimpleTestResult ResultReceived SimpleTestResult }
SimpleTest Type is a Type of a simple HTTP Test.
type SimpleTestParameter ¶
type SimpleTestParameter struct { RequestMethod string RequestUrl string RequestBody io.Reader RequestHandler http.HandlerFunc }
SimpleTestParameter Type is a Parameter of a simple HTTP Test.
type SimpleTestResult ¶
SimpleTestResult Type is a Result of a simple HTTP Test.