jpw
jpw

Reputation: 19247

Sinantra, how access URL params such as "?something=xyz" in a POST handler (it's not in params[])

We're using a third party web service that POSTS multipart data (a file) back to us. But it ALSO passes an extra param via the url http://ourdomain.com/theposturl?extra=good

the 'filename' object with :filename and :tempfile for the binary data are in params[]

but how do we get the "good" off of the url?

post /theposturl
  puts params.inspect    # this shows a hash with filename, 
                         # :filename and :tempfile as expected

  extra_param = ??????[:extra] # but what lets us 'read' the ?extra=good off the url

end

Upvotes: 3

Views: 3452

Answers (1)

thargor
thargor

Reputation: 453

You need to use a string as the hash key.

extra_param = params["extra"]

Upvotes: 10

Related Questions