gentleman.v2: Index | Files

package utils

import ""

Package utils provides a set of reusable HTTP client utilities used internally in gentleman for required functionality and testing.


Package Files


func NopCloser Uses

func NopCloser() io.ReadCloser

NopCloser returns a ReadCloser with a no-op Close

method wrapping the provided Reader r.

func ReplyWithStatus Uses

func ReplyWithStatus(res *http.Response, code int)

ReplyWithStatus helper to write the http.Response status code and text.

func StringReader Uses

func StringReader(body string) io.ReadCloser

StringReader creates an io.ReadCloser interface from a string.

func WriteBodyString Uses

func WriteBodyString(res *http.Response, body string)

WriteBodyString writes a string based body in a given http.Response.

type XMLCharDecoder Uses

type XMLCharDecoder func(charset string, input io.Reader) (io.Reader, error)

XMLCharDecoder is a helper type that takes a stream of bytes (not encoded in UTF-8) and returns a reader that encodes the bytes into UTF-8. This is done because Go's XML library only supports XML encoded in UTF-8.

Package utils imports 5 packages (graph) and is imported by 8 packages. Updated 2020-02-18. Refresh now. Tools for package owners.