http

package
v0.0.0-...-77ed03d Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2017 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package http provides a imageserver.Server implementation that gets the Image from an HTTP URL.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IdentifyHeader

func IdentifyHeader(resp *http.Response, data []byte) (format string, err error)

IdentifyHeader identifies the Image format with the "Content-Type" header.

Types

type Server

type Server struct {
	// Client is an optional HTTP client.
	// http.DefaultClient is used by default.
	Client *http.Client

	// Identify identifies the Image format.
	// By default, it uses IdentifyHeader().
	Identify func(resp *http.Response, data []byte) (format string, err error)
}

Server is a imageserver.Server implementation that gets the Image from an HTTP URL.

It parses the "source" param as URL, then do a GET request. It returns an error if the HTTP status code is not 200 (OK).

func (*Server) Get

func (srv *Server) Get(params imageserver.Params) (*imageserver.Image, error)

Get implements imageserver.Server.

Jump to

Keyboard shortcuts

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