0

While using net/http and net/url for single key value I am getting this error

multiple-value http.PostForm() in single-value context
1
  • Can you give some context? What code caused the error? What was the input? Commented Mar 27, 2014 at 8:10

1 Answer 1

3

Your error possibly caused by single-value assignment — PostForm (both for Client and Response) returns (resp *Response, err error) (value and an error), so you need to do something like:

resp, err := http.PostForm("http://example.com/form", url.Values{"key": {"Value"}, "id": {"123"}})

while you doing (my suggestion)

resp := http.PostForm("http://example.com/form", url.Values{"key": {"Value"}, "id": {"123"}})
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.