jsonRequest

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: MIT Imports: 5 Imported by: 0

README

jsonRequest

Description

This package was made for quickly and easily creating json requests for use in testing (in particular with GoFiber).

Usage

Creating a request
person := Person{
    Name: "John Doe",
    Age:  42,
}

// First value is the path, second is the body
req, _ := jsonRequest.PostJsonReq("/", person)
app.test(req)
Expect(resp.StatusCode).To(Equal(http.StatusCreated))

Note: gomega is used to compare status codes and app is an instance of a fiber app.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PostJsonReq

func PostJsonReq(requestRoute string, requestObject interface{}) (*http.Request, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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