-
Notifications
You must be signed in to change notification settings - Fork 328
Closed
Description
There are 2 things I'd like to do with this library and not sure how to do it.
First, I'd like to print out the request to see if everything looks correct. I'm thinking something like HTTP.headers(some_hash).get(some_url).to_s which will create a string something like GET some_url headers: some_headers. With this I don't need to waste time with MiTM apps and can see the conversion is correct.
Second, I'd like to build a request without executing it. How can I do this? I couldn't find it in your docs/code. The reason is I need to create a signature token based on the request headers + body (it's for AWS). Having this ability would greatly simplify coding.
# (pseudo code for idea - ignore syntax correctness)
# current
headers = { some: values }
payload = something
content_size = payload.size
uri = some_url_with_params
signature = calculate_signature(headers.merge(content-length: content_size), payload, host_uri, params)
res = HTTP.headers(headers.merge(Authorization: signature).get(uri)
# my wish
request = HTTP.headers( some: values).build_request(:get, uri, { body: payload })
response = request.headers(Authorization: calculate_signature(request)).runHope this makes sense.
ingemar
Metadata
Metadata
Assignees
Labels
No labels