urlutil

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package urlutil provides utilities for working with URLs.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidScheme is returned by [Get] when the scheme of
	// the provided URL is not supported.
	ErrInvalidScheme = errors.New("invalid scheme")

	// ErrInvalidURL is returned by [Get] when the provided URL is
	// not valid.
	ErrInvalidURL = errors.New("invalid URL")
)

Functions

func Get

func Get(rawURL string) ([]byte, error)

Get retrieves the contents from a given raw URL. It returns error if the URL is not valid or if it is not possible to get the contents.

It supports the following schemes: http, https. If the provided URL does not specify a scheme, it is considered a file path. In the case of http and https, the contents are retrieved issuing an HTTP GET request.

Types

This section is empty.

Jump to

Keyboard shortcuts

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