cfparser

module
v0.0.0-...-b86a605 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: Apache-2.0

README

Install

go get github.com/0x204/cfparser

Example of usage

Simple GET

package main

import (
	"fmt"
	"io"

	http "github.com/bogdanfinn/fhttp"
	"github.com/0x204/cfparser/src"
)

func main() {
	client := &http.Client{}
	client.Transport, _ = src.New(client.Transport)

	resp, _ := client.Get("https://example.com")
	defer resp.Body.Close()

	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}

Customize request

req, _ := http.NewRequest(http.MethodGet, "https://example.com/api", nil)

req.Header.Set("X-Custom-Header", "value")
req.Header.Set("Accept", "application/json")
req.Header.Set("Referer", "https://google.com")

resp, _ := client.Do(req)

POST with JSON body

payload := `{"key":"value"}`

req, _ := http.NewRequest(http.MethodPost, "https://example.com/api", bytes.NewBuffer([]byte(payload)))
req.Header.Set("Content-Type", "application/json")

resp, _ := client.Do(req)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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