//
// http.Post with params
//
168307
func Post(urlStr string, params map[string]interface{}) (*HttpResponse, error) {
	resp, err := DefaultClient.PostForm(urlStr, URLWithParams(urlStr, params).Query())
	if err == nil {
		return &HttpResponse{*resp}, nil
	} else {
		CloseResponse(resp)
		return nil, err
	}
}
527196
func PathParams(req *http.Request) (params map[string]string) {
	ex := getRequestExecution(req)
	params = make(map[string]string)
	for k, v := range ex.params {
		params[k] = v
	}
	return
}
26441
func Post(url, bodyType string, body interface{}) (*http.Response, error) {
	return defaultClient.Post(url, bodyType, body)
}
591822
func (c *Client) Params(params map[string]string) *Client {
	c.Use(url.Params(params))
	return c
}
1026259
func (c *HTTPClient) Post(url string, bodyType string, body io.Reader) (*http.Response, error) {
	var resp *http.Response
	breaker := c.breakerLookup(url)
	err := breaker.Call(func() error {
		aresp, err := c.Client.Post(url, bodyType, body)
		resp = aresp
		return err
	}, c.timeout)
	return resp, err
}
479542
func (c *client) post(rawurl string, in, out interface{}) error {
	return c.do(rawurl, "POST", in, out)
}
656083
func (m *MetaClient) Post(ctx context.Context, path string, action interface{}, params map[string]string) error {
	b, err := json.Marshal(action)
	if err != nil {
		return err
	}
	body := bytes.NewReader(b)
	_, err = m.Do(ctx, path, "POST", m.authorizer, params, body)
	if err != nil {
		return err
	}
	return nil
}
417956
func (a *Core) post(uri string, reqBody, response interface{}) (*http.Response, error) {
	content, err := json.Marshal(reqBody)
	if err != nil {
		return nil, errors.New("failed to marshal message")
	}

	return a.retrievablePost(uri, content, response)
}
1317621
func (l *Client) Post(endpoint string, params url.Values, body interface{}, response, data interface{}) error {
	return l.PostType("application/json", endpoint, params, body, response, data)
}
997788
func (s *Service) post(w http.ResponseWriter, r *http.Request, _ mux.Params) {
	// Read request body's json payload into buffer.
	b, err := ioutil.ReadAll(r.Body)
	todo, err := decode(b)
	if err != nil {
		http.Error(w, err.Error(), 500)
	}

	// Use the url path as key.
	key := []byte(r.URL.String())

	// Put key/buffer into todos bucket.
	if err := s.todos.Put(key, b); err != nil {
		http.Error(w, err.Error(), 500)
		return
	}

	if verbose {
		log.Printf("server: %s: %v", key, todo.Task)
	}

	w.Header().Set("Content-Type", "text/plain")
	fmt.Fprintf(w, "put todo for %s: %s\n", key, todo)
}
1063094
func (c *Client) post(url string, todo *Todo) error {
	bodyType := "application/json"
	body, err := todo.Encode()
	if err != nil {
		return err
	}
	resp, err := http.Post(url, bodyType, body)
	if err != nil {
		return err
	}
	if verbose {
		log.Printf("client: %s\n", resp.Status)
	}
	return nil
}
597017
func (this *Server) Param(p string, fn func(*Request, *Response, func())) {
	this.Router.AddParamFunc(p, fn)
}
338839
func ParamJson(r *http.Request, name string, v interface{}) error {
	value := r.FormValue(name)
	return json.Unmarshal([]byte(value), v)
}
1044433
func (c *Client) Post() *Request {
	req := c.Request()
	req.Method("POST")
	return req
}
1355588
func (api UsersAPI) Post(w http.ResponseWriter, r *http.Request) {

	var u user.User

	if err := json.NewDecoder(r.Body).Decode(&u); err != nil {
		http.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)
		return
	}

	userMgr := user.NewManager(r)
	if err := userMgr.Save(&u); err != nil {
		log.Error("ERROR while saving user:\n", err)
		http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
		return
	}

	w.Header().Set("Content-Type", "application/json")
	w.WriteHeader(http.StatusCreated)

	json.NewEncoder(w).Encode(&u)
}
750556
func (r *Request) Params(params map[string]string) *Request {
	r.Use(url.Params(params))
	return r
}
261282
func (b *HttpRequest) Param(key, value string) *HttpRequest {
	b.params[key] = value
	return b
}