google app engine - How to send 204 No Content with Go http package? -


i built tiny sample app go on google app engine sends string responses when different urls invoked. how can use go's http package send 204 no content response clients?

package hello  import (     "fmt"     "net/http"     "appengine"     "appengine/memcache" )  func init() {     http.handlefunc("/", hello)     http.handlefunc("/hits", showhits) }  func hello(w http.responsewriter, r *http.request) {     name := r.header.get("name")     fmt.fprintf(w, "hello %s!", name) }  func showhits(w http.responsewriter, r *http.request) {     fmt.fprintf(w, "%d", hits(r)) }  func hits(r *http.request) uint64 {     c := appengine.newcontext(r)     newvalue, _ := memcache.increment(c, "hits", 1, 0)     return newvalue } 

according package docs:

func nocontent(w http.responsewriter, r *http.request) {   // set headers want here.   w.writeheader(204) // send headers 204 response code. } 

will send 204 status client.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -