Skip to content
/ curlreq Public

curlreq creates *http.Request from curl command.

License

Notifications You must be signed in to change notification settings

k1LoW/curlreq

Repository files navigation

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.

About

curlreq creates *http.Request from curl command.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •