Giter Site home page Giter Site logo

martini-etag's People

Contributors

cgarvis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

johanhenselmans

martini-etag's Issues

ETag to the martini contrib?

I think this small piece of code would be great candidate for the martini contrib collection. Don't you think?

Header isn't set with multiple return values

In the following example, /a will return an ETag header and /b won't.

package main

import . "github.com/cgarvis/martini-etag"
import "github.com/codegangsta/martini"

func main() {
    m := martini.Classic()
    m.Use(ETag())                                                                                                                                                                                         
    m.Get("/a", func() string {
        a := make([]byte, 2000)
        return string(a)
    })
    m.Get("/b", func() (int, string) {
        b := make([]byte, 2000)
        return 200, string(b)
    })
    m.Run()
}

No Etag When Using `martini-contrib/render` to JSON

I'm using "github.com/martini-contrib/render" to render r.JSON(200, userStruct) and no Etag header is being added. I've checked some of the none-json routes and I have the same issue.

I'm basically doing:

func main() {
  m := martini.Classic()
  m.Use(ETag())
  var appEnv *AppEnv = LoadEnv()
  m.Map(appEnv)
  m.Use(render.Renderer())
  appName.RegisterRoutes(m)
  m.Run()
}

func RegisterRoutes(m *martini.ClassicMartini) {
  m.Get("/status", func(r render.Render) {
    r.Text(200, "SUCCESS")
  })
}

Confusing Example

I think the README should be updated with an example that sends >= 1024 bytes. An example that sends an ETag would be less confusing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.