http

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Rendered for js/wasm

Overview

Package http makes XML HTTP Requests using native browser code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// Timeout is the amount of time a request can take before being considered timed out.
	Timeout time.Duration
}

Client makes HTTP requests.

func (Client) Do

func (c Client) Do(dom DOM, req Request) (*Response, error)

Do makes a HTTP request.

type DOM added in v1.2.0

type DOM interface {
	NewXHR() js.Value
	NewJsEventFunc(fn func(event js.Value)) js.Func
}

DOM creates http requests

type Request

type Request struct {
	// Method is the HTTP method (GET/POST).
	Method string
	// URL is the address to the server.
	URL string
	// Headers contain additional request properties.
	Headers map[string]string
	// Body contains additional request data.
	Body string
}

Request identifies the question to ask a server.

type Response

type Response struct {
	// Code is a descriptive status about the server handled the response (200 OK, 500 Internal Server Error).
	Code int
	// Body contains the response data.
	Body string
	// contains filtered or unexported fields
}

Response is what the server responds.

Jump to

Keyboard shortcuts

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