mimetools

package
v0.0.0-...-6b20280 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2014 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

mimetools.Matcher allows matching against wildcard mediaTypes.

Example: mm := mimetools.NewMatcher([]string{"text/*", "application/json"}) mm.Match("text/html") // returns true, nil mm.Match("text/plain") //returns true, nil mm.Match("application/json") // returns true, nil mm.Match("application/vnd.ms-excel") // returns false, nil

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Matcher

type Matcher struct {
	// contains filtered or unexported fields
}

Matcher will match Accept or Content-Type mime types that include *

func NewMatcher

func NewMatcher(mediaTypes []string) (*Matcher, error)

NewMatcher returns a new matcher instance and any errors that occurred. Note that if an error is returned, a Matcher is returned that matches any mime type.

func (*Matcher) Match

func (mm *Matcher) Match(mimeString string) (bool, error)

Jump to

Keyboard shortcuts

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