package
0.0.0-20140208234550-8ce6181c2609
Repository: https://github.com/codegangsta/martini-contrib.git
Documentation: pkg.go.dev

# README

cors

Martini middleware/handler to enable CORS support.

Usage

import (
  "github.com/codegangsta/martini"
  "github.com/codegangsta/martini-contrib/cors"
)

func main() {
  m := martini.Classic()
  // CORS for https://foo.* origins, allowing:
  // - PUT and PATCH methods
  // - Origin header
  // - Credentials share
  m.Use(cors.Allow(&cors.Options{
    AllowOrigins:     []string{"https://foo\\.*"},
    AllowMethods:     []string{"PUT", "PATCH"},
    AllowHeaders:     []string{"Origin"},
    ExposeHeaders:    []string{"Content-Length"},
    AllowCredentials: true,
  }))
  m.Run()
}

Authors

# Functions

Allows CORS for requests those match the provided options.

# Structs

Represents Access Control options.