Categorygithub.com/goark/fetch
modulepackage
0.4.1
Repository: https://github.com/goark/fetch.git
Documentation: pkg.go.dev

# README

fetch -- Fetch Data from URL

check vulns lint status GitHub license GitHub release

This package is required Go 1.16 or later.

Migrated repository to github.com/goark/fetch

Import

import "github.com/goark/fetch"

Usage

package main

import (
    "context"
    "fmt"
    "io"
    "os"

    "github.com/goark/fetch"
)

func main() {
    u, err := fetch.URL("https://github.com/spiegel-im-spiegel.gpg")
    if err != nil {
        fmt.Fprintln(os.Stderr, err)
        return
    }
    resp, err := fetch.New().GetWithContext(context.Background(), u)
    if err != nil {
        fmt.Fprintln(os.Stderr, err)
        return
    }
    defer resp.Close()
    if _, err := io.Copy(os.Stdout, resp.Body()); err != nil {
        fmt.Fprintln(os.Stderr, err)
    }
}

Modules Requirement Graph

dependency.png

# Functions

New function returns Client instance.
URL function returns url.URL instance from string.
WithProtocol returns function for setting context.Context.
WithProtocol returns function for setting http.Client.
WithRequestHeaderAdd returns function for adding request header in http.Request.
WithRequestHeaderSet returns function for setting request header in http.Request.

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

Client is inteface class for HTTP client.
Response is inteface class for HTTP response.

# Type aliases

No description provided by the author
No description provided by the author