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

StackOverflow https://stackoverflow.com/questions/5022030

  •  14-11-2019
  •  | 
  •  

Вопрос

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
Это было полезно?

Решение

You need to use a string as the hash key.

extra_param = params["extra"]
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top