如何从 Sinatra 中转储 HTTP 请求?
有没有一种方法可以按照应用程序接收数据的方式将所有传入请求转储到 Sinatra 应用程序?也许某种 Rack 中间件?
Is there a way to dump all incoming requests to a Sinatra application in the exact way the application receives the data? Maybe some sort of Rack middleware?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当我想调试“事物”时,我使用
-D
和-V
标志运行瘦:如果您尝试从请求获取原始输出,请使用该请求方法如下:
请参阅“入门”了解更多信息。
I run thin with the
-D
and-V
flags when I want to debug 'things':If you are trying to get the raw output from a request, use the request method like:
See "GETTING STARTED" for more information.
也许这不是您要问的,但我来到这里寻找一种方法来查看 Sinatra 中的所有 HTTP 请求标头(实际上不必枚举它们,以调试代理请求)。我发现这非常有用:
或者,以清晰的 json 格式在响应中返回该 blob:
瞧,所有请求详细信息:
Maybe this is not what you're asking, but I arrived here looking for a way to see all the HTTP request headers in Sinatra (without actually having to enumerate them, to debug a proxied request). I found this quite useful:
Or, to return that blob in the response in a legible json format:
And voila, all the request details: