Skip to content

Instantly share code, notes, and snippets.

@andboson
Created June 3, 2015 07:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andboson/10be62c66c5c4610f5d5 to your computer and use it in GitHub Desktop.
Save andboson/10be62c66c5c4610f5d5 to your computer and use it in GitHub Desktop.
post go
type FFiltersController struct {
Request *http.Request
Response http.ResponseWriter
}
type inputRequest struct {
Id int `json:"id"`
Url string `json:"url"`
SaleLocationId string `json:"sale_location_id"`
Categories []string `json:"categories"`
}
func (c *FFiltersController) getById() {
var data FastFiltersResponse
var input inputRequest
var presetModel models.Preset
debug, _ := services.AppConfig.Bool("debug")
body, error := ioutil.ReadAll(c.Request.Body)
error = json.Unmarshal(body, &input)
......
......
data = c.createPreset(*preset, input.SaleLocationId)
jsonData, _ := json.Marshal(data)
c.Response.Header().Set("Content-Type", "application/json")
c.Response.Write(jsonData)
return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment