Commit 0890bd17 by lanrion

refactor http_post headers params

parent 67610f42
...@@ -17,7 +17,7 @@ module WeixinAuthorize ...@@ -17,7 +17,7 @@ module WeixinAuthorize
def http_post_without_token(url, payload={}, headers={}, endpoint="plain") def http_post_without_token(url, payload={}, headers={}, endpoint="plain")
post_api_url = endpoint_url(endpoint, url) post_api_url = endpoint_url(endpoint, url)
payload = MultiJson.dump(payload) if endpoint == "plain" # to json if invoke "plain" payload = MultiJson.dump(payload) if endpoint == "plain" # to json if invoke "plain"
load_json(RestClient.post(post_api_url, payload, headers)) load_json(RestClient.post(post_api_url, payload, :params => headers))
end end
# return hash # return hash
......
...@@ -45,7 +45,7 @@ module WeixinAuthorize ...@@ -45,7 +45,7 @@ module WeixinAuthorize
end end
def http_post(url, payload={}, headers={}, endpoint="plain") def http_post(url, payload={}, headers={}, endpoint="plain")
headers = {:params => access_token_param.merge(headers)} headers = access_token_param.merge(headers)
WeixinAuthorize.http_post_without_token(url, payload, headers, endpoint) WeixinAuthorize.http_post_without_token(url, payload, headers, endpoint)
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment