fhttp

package module
v0.0.0-...-9880495 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2022 License: MIT Imports: 3 Imported by: 1

README

fhttp adapter

This example contains a fhttp package which implements an adapter for fhttp.

Usage

package main

import (
	"github.com/sleeyax/gotcha"
	"github.com/sleeyax/gotcha/adapters/fhttp"
	http "github.com/useflyent/fhttp"
	"log"
)

func main() {
	client, err := gotcha.NewClient(&gotcha.Options{
		// Adapter: fhttp.NewAdapter(),
		Adapter: &fhttp.Adapter{
			// Optionally define custom http.Transport options here 
			Transport: &http.Transport{},
		},
	})
	if err != nil {
		log.Fatal(err)
	}
	res, _ := client.Get("https://httpbin.org/anything", &gotcha.Options{
		Headers: map[string][]string{
			"user-agent":        {"gotcha By Sleeyax (https://github.com/sleeyax/gotcha)"},
			"foo":               {"bar"},
			"abc":               {"def", "123"},
			http.HeaderOrderKey: {"abc", "user-agent", "foo"},
		},
	})
	// ...
}

Test

$ go run ./main.go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter struct {
	// Optional fhttp Transport options.
	Transport *fhttp.Transport
}

func NewAdapter

func NewAdapter() *Adapter

func (*Adapter) DoRequest

func (a *Adapter) DoRequest(options *gotcha.Options) (*gotcha.Response, error)

Jump to

Keyboard shortcuts

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