Categorygithub.com/k1LoW/curlreq
modulepackage
0.3.3
Repository: https://github.com/k1low/curlreq.git
Documentation: pkg.go.dev

# README

curlreq

build Go Reference Coverage Code to Test Ratio Test Execution Time

curlreq creates *http.Request from curl command.

Usage

package main

import (
	"fmt"
	"log"
	"net/http"

	"github.com/k1LoW/curlreq"
)

func main() {
	cmd := "curl https://example.com"
	req, err := curlreq.NewRequest(cmd)
	if err != nil {
		log.Fatal(err)
	}
	client := http.DefaultClient
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	defer resp.Body.Close()

	fmt.Println(resp.StatusCode)

	// Output:
	// 200
}

Reference

  • tj/parse-curl.js: Parse curl commands, returning an object representing the request.

# Functions

NewRequest returns *http.Request created by parsing a curl command.
Parse a curl command.

# Structs

No description provided by the author