httpmatchers

package module
v0.0.0-...-59008f2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2015 License: MIT Imports: 4 Imported by: 0

README

httpmatchers

GoDoc

Package httpmatchers provides a set of custom matchers for github.com/onsi/gomega to use for testing responses from HTTP server handlers.

Specifically it allows you to replace code like this

Expect(w.Code).To(Equal(http.StatusOK), "HTTP Status should be OK")

Which yields an error message like

HTTP Status should be OK
Expected
	<int>: 400
to equal
	<int>: 200

With this code

Expect(w.Code).To(BeHTTPStatusOK())

Which yields an error message like this

Expected
	<string>: HTTP status 400 Bad Request
to be
	<string>: HTTP status 200 OK

Documentation

Overview

Package httpmatchers provides a set of custom matchers for github.com/onsi/gomega to use for testing responses from HTTP server handlers.

Specifically it allows you to replace code like this

Expect(w.Code).To(Equal(http.StatusOK), "HTTP Status should be OK")

Which yields an error message like

HTTP Status should be OK
Expected
	<int>: 400
to equal
	<int>: 200

With this code

Expect(w.Code).To(BeHTTPStatusOK())

Which yields an error message like this

Expected
	<string>: HTTP status 400 Bad Request
to be
	<string>: HTTP status 200 OK

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeHTTPStatusAccepted

func BeHTTPStatusAccepted() types.GomegaMatcher

BeHTTPStatusAccepted matches the HTTP status code 202 Accepted

func BeHTTPStatusBadGateway

func BeHTTPStatusBadGateway() types.GomegaMatcher

BeHTTPStatusBadGateway matches the HTTP status code 502 Bad Gateway

func BeHTTPStatusBadRequest

func BeHTTPStatusBadRequest() types.GomegaMatcher

BeHTTPStatusBadRequest matches the HTTP status code 400 Bad Request

func BeHTTPStatusConflict

func BeHTTPStatusConflict() types.GomegaMatcher

BeHTTPStatusConflict matches the HTTP status code 409 Conflict

func BeHTTPStatusContinue

func BeHTTPStatusContinue() types.GomegaMatcher

BeHTTPStatusContinue matches the HTTP status code 100 Continue

func BeHTTPStatusCreated

func BeHTTPStatusCreated() types.GomegaMatcher

BeHTTPStatusCreated matches the HTTP status code 201 Created

func BeHTTPStatusExpectationFailed

func BeHTTPStatusExpectationFailed() types.GomegaMatcher

BeHTTPStatusExpectationFailed matches the HTTP status code 417 Expectation Failed

func BeHTTPStatusForbidden

func BeHTTPStatusForbidden() types.GomegaMatcher

BeHTTPStatusForbidden matches the HTTP status code 403 Forbidden

func BeHTTPStatusFound

func BeHTTPStatusFound() types.GomegaMatcher

BeHTTPStatusFound matches the HTTP status code 302 Found

func BeHTTPStatusGatewayTimeout

func BeHTTPStatusGatewayTimeout() types.GomegaMatcher

BeHTTPStatusGatewayTimeout matches the HTTP status code 504 Gateway Timeout

func BeHTTPStatusGone

func BeHTTPStatusGone() types.GomegaMatcher

BeHTTPStatusGone matches the HTTP status code 410 Gone

func BeHTTPStatusHTTPVersionNotSupported

func BeHTTPStatusHTTPVersionNotSupported() types.GomegaMatcher

BeHTTPStatusHTTPVersionNotSupported matches the HTTP status code 505 HTTP Version Not Supported

func BeHTTPStatusInternalServerError

func BeHTTPStatusInternalServerError() types.GomegaMatcher

BeHTTPStatusInternalServerError matches the HTTP status code 500 Internal Server Error

func BeHTTPStatusLengthRequired

func BeHTTPStatusLengthRequired() types.GomegaMatcher

BeHTTPStatusLengthRequired matches the HTTP status code 411 Length Required

func BeHTTPStatusMethodNotAllowed

func BeHTTPStatusMethodNotAllowed() types.GomegaMatcher

BeHTTPStatusMethodNotAllowed matches the HTTP status code 405 Method Not Allowed

func BeHTTPStatusMovedPermanently

func BeHTTPStatusMovedPermanently() types.GomegaMatcher

BeHTTPStatusMovedPermanently matches the HTTP status code 301 Moved Permanently

func BeHTTPStatusMultipleChoices

func BeHTTPStatusMultipleChoices() types.GomegaMatcher

BeHTTPStatusMultipleChoices matches the HTTP status code 300 Multiple Choices

func BeHTTPStatusNoContent

func BeHTTPStatusNoContent() types.GomegaMatcher

BeHTTPStatusNoContent matches the HTTP status code 204 No Content

func BeHTTPStatusNonAuthoritativeInfo

func BeHTTPStatusNonAuthoritativeInfo() types.GomegaMatcher

BeHTTPStatusNonAuthoritativeInfo matches the HTTP status code 203 Non Authoritative Info

func BeHTTPStatusNotAcceptable

func BeHTTPStatusNotAcceptable() types.GomegaMatcher

BeHTTPStatusNotAcceptable matches the HTTP status code 406 Not Acceptable

func BeHTTPStatusNotFound

func BeHTTPStatusNotFound() types.GomegaMatcher

BeHTTPStatusNotFound matches the HTTP status code 404 Not Found

func BeHTTPStatusNotImplemented

func BeHTTPStatusNotImplemented() types.GomegaMatcher

BeHTTPStatusNotImplemented matches the HTTP status code 501 Not Implemented

func BeHTTPStatusNotModified

func BeHTTPStatusNotModified() types.GomegaMatcher

BeHTTPStatusNotModified matches the HTTP status code 304 Not Modified

func BeHTTPStatusOK

func BeHTTPStatusOK() types.GomegaMatcher

BeHTTPStatusOK matches the HTTP status code 200 OK

func BeHTTPStatusPartialContent

func BeHTTPStatusPartialContent() types.GomegaMatcher

BeHTTPStatusPartialContent matches the HTTP status code 206 Partial Content

func BeHTTPStatusPaymentRequired

func BeHTTPStatusPaymentRequired() types.GomegaMatcher

BeHTTPStatusPaymentRequired matches the HTTP status code 402 Payment Required

func BeHTTPStatusPreconditionFailed

func BeHTTPStatusPreconditionFailed() types.GomegaMatcher

BeHTTPStatusPreconditionFailed matches the HTTP status code 412 Precondition Failed

func BeHTTPStatusProxyAuthRequired

func BeHTTPStatusProxyAuthRequired() types.GomegaMatcher

BeHTTPStatusProxyAuthRequired matches the HTTP status code 407 Proxy Auth Required

func BeHTTPStatusRequestEntityTooLarge

func BeHTTPStatusRequestEntityTooLarge() types.GomegaMatcher

BeHTTPStatusRequestEntityTooLarge matches the HTTP status code 413 Request Entity Too Large

func BeHTTPStatusRequestTimeout

func BeHTTPStatusRequestTimeout() types.GomegaMatcher

BeHTTPStatusRequestTimeout matches the HTTP status code 408 Request Timeout

func BeHTTPStatusRequestURITooLong

func BeHTTPStatusRequestURITooLong() types.GomegaMatcher

BeHTTPStatusRequestURITooLong matches the HTTP status code 414 Request URIToo Long

func BeHTTPStatusRequestedRangeNotSatisfiable

func BeHTTPStatusRequestedRangeNotSatisfiable() types.GomegaMatcher

BeHTTPStatusRequestedRangeNotSatisfiable matches the HTTP status code 416 Requested Range Not Satisfiable

func BeHTTPStatusResetContent

func BeHTTPStatusResetContent() types.GomegaMatcher

BeHTTPStatusResetContent matches the HTTP status code 205 Reset Content

func BeHTTPStatusSeeOther

func BeHTTPStatusSeeOther() types.GomegaMatcher

BeHTTPStatusSeeOther matches the HTTP status code 303 See Other

func BeHTTPStatusServiceUnavailable

func BeHTTPStatusServiceUnavailable() types.GomegaMatcher

BeHTTPStatusServiceUnavailable matches the HTTP status code 503 Service Unavailable

func BeHTTPStatusSwitchingProtocols

func BeHTTPStatusSwitchingProtocols() types.GomegaMatcher

BeHTTPStatusSwitchingProtocols matches the HTTP status code 101 Switching Protocols

func BeHTTPStatusTeapot

func BeHTTPStatusTeapot() types.GomegaMatcher

BeHTTPStatusTeapot matches the HTTP status code 418 Teapot

func BeHTTPStatusTemporaryRedirect

func BeHTTPStatusTemporaryRedirect() types.GomegaMatcher

BeHTTPStatusTemporaryRedirect matches the HTTP status code 307 Temporary Redirect

func BeHTTPStatusUnauthorized

func BeHTTPStatusUnauthorized() types.GomegaMatcher

BeHTTPStatusUnauthorized matches the HTTP status code 401 Unauthorized

func BeHTTPStatusUnsupportedMediaType

func BeHTTPStatusUnsupportedMediaType() types.GomegaMatcher

BeHTTPStatusUnsupportedMediaType matches the HTTP status code 415 Unsupported Media Type

func BeHTTPStatusUseProxy

func BeHTTPStatusUseProxy() types.GomegaMatcher

BeHTTPStatusUseProxy matches the HTTP status code 305 Use Proxy

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL