Documentation
¶
Index ¶
- func CheckIfResponseHasError(rsp *http.Response) error
- func FromByteStreamToProtocolBuffers(byteStreamContainingMessage *bufio.Reader, out proto.Message) error
- func HTTPRequestToProto(req *http.Request, protoRequestOut proto.Message) error
- func SerializeAsPayload(messageContentsInBytes []byte) []byte
- func WriteErrorToHTTPResponse(w http.ResponseWriter, errorObtained error)
- func WriteProtoToHTTPResponse(w http.ResponseWriter, msg proto.Message) error
- type FlushableResponseWriter
- type HTTPError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckIfResponseHasError ¶
CheckIfResponseHasError checks an HTTP Response for errors and returns error information with the following precedence: 1. "linkerd-error" header, with protobuf-encoded apiError 2. non-200 Status Code, with Kubernetes StatusError 3. non-200 Status Code
func FromByteStreamToProtocolBuffers ¶
func FromByteStreamToProtocolBuffers(byteStreamContainingMessage *bufio.Reader, out proto.Message) error
FromByteStreamToProtocolBuffers converts a byte stream to a protobuf message.
func HTTPRequestToProto ¶
HTTPRequestToProto converts an HTTP Request to a protobuf request.
func SerializeAsPayload ¶
SerializeAsPayload appends a 4-byte length in front of a byte slice.
func WriteErrorToHTTPResponse ¶
func WriteErrorToHTTPResponse(w http.ResponseWriter, errorObtained error)
WriteErrorToHTTPResponse writes a protobuf-encoded error to an HTTP Response.
func WriteProtoToHTTPResponse ¶
func WriteProtoToHTTPResponse(w http.ResponseWriter, msg proto.Message) error
WriteProtoToHTTPResponse writes a protobuf-encoded message to an HTTP Response.
Types ¶
type FlushableResponseWriter ¶
type FlushableResponseWriter interface { http.ResponseWriter http.Flusher }
FlushableResponseWriter wraps a ResponseWriter for use in streaming responses
func NewStreamingWriter ¶
func NewStreamingWriter(w http.ResponseWriter) (FlushableResponseWriter, error)
NewStreamingWriter takes a ResponseWriter and returns it wrapped in a FlushableResponseWriter.