utils

package
v2.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT, MIT Imports: 5 Imported by: 0

README

gentleman/utils Build Status GoDoc API Go Report Card

utils package provides a few HTTP specific utilities internally used by gentleman.

Installation

go get -u gitee.com/trako/gentleman/utils

API

See godoc reference.

License

MIT - Tomas Aparicio

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NopCloser

func NopCloser() io.ReadCloser

NopCloser returns a ReadCloser with a no-op Close

method wrapping the provided Reader r.

func ReplyWithStatus

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

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

func StringReader

func StringReader(body string) io.ReadCloser

StringReader creates an io.ReadCloser interface from a string.

func WriteBodyString

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

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

Types

type XMLCharDecoder

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.

Jump to

Keyboard shortcuts

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