net

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2023 License: MIT Imports: 5 Imported by: 1

Documentation

Overview

* Copyright (c) 2023 Juice Technologies, Inc. All Rights Reserved.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get[T any](client *http.Client, url string) (T, error)

func ParseBody added in v0.1.1

func ParseBody(body io.Reader, length int64) ([]byte, error)

func Post

func Post[T any](client *http.Client, url string) (T, error)

func PostNoResponse

func PostNoResponse(client *http.Client, url string) error

func PostWithBody

func PostWithBody[T, T1 any](client *http.Client, url string, obj T1) (T, error)

func PostWithBodyNoResponse added in v0.1.1

func PostWithBodyNoResponse[T any](client *http.Client, url string, obj T) error

func PostWithBodyReturnString added in v0.1.1

func PostWithBodyReturnString[T any](client *http.Client, url string, obj T) (string, error)

func ReadBody

func ReadBody[T any](header http.Header, statusCode int, body io.ReadCloser, contentLength int64) (T, error)

func ReadBodyAsBytes

func ReadBodyAsBytes(header http.Header, statusCode int, body io.ReadCloser, contentLength int64) ([]byte, error)

func ReadRequestBody added in v0.1.1

func ReadRequestBody[T any](r *http.Request) (T, error)

func ReadResponseBody added in v0.1.1

func ReadResponseBody[T any](r *http.Response) (T, error)

func ReadResponseBodyAsString added in v0.1.1

func ReadResponseBodyAsString(r *http.Response) (string, error)

func Respond

func Respond[T any](w http.ResponseWriter, code int, obj T) error

func RespondEmpty

func RespondEmpty(w http.ResponseWriter, code int)

func RespondWithString

func RespondWithString(w http.ResponseWriter, code int, msg string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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