json 在 Mac 上使用 Safari 通过 HTTP 发送 POST 请求
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14839447/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Sending POST request via HTTP using Safari on Mac
提问by Fry
I need to call a webservice with Safari on Mac. Since the methods are in POST I can't paste the url in the address bar of Safari (like with GET methods).
我需要在 Mac 上使用 Safari 调用网络服务。由于这些方法在 POST 中,我无法将 url 粘贴到 Safari 的地址栏中(就像使用 GET 方法一样)。
So, I'm looking for a plug-in or similar that allows me to send the request and then receive the response inside the browser. The response is JSON so with the JSON plug in I can see all the response with his formatting.
所以,我正在寻找一个插件或类似的插件,它允许我发送请求,然后在浏览器内接收响应。响应是 JSON,所以使用 JSON 插件,我可以看到所有带有他的格式的响应。
Solutions ? Thanks !
解决方案?谢谢 !
采纳答案by Fry
回答by nallenscott
Safari is my browser of choice, so I can empathize with you for wanting a native plugin. Fortunately, while there aren't any extensions available, there are quite a few native OSX clients for HTTP/REST end-point testing. I have been using CocoaRestClient, which includes auto-formatting and syntax highlighting for JSON, as you requested. It's open source, lightweight, and is at least actively supported by its developers:
Safari 是我选择的浏览器,所以我可以理解你想要一个原生插件。幸运的是,虽然没有任何扩展可用,但有相当多的原生 OSX 客户端用于 HTTP/REST 端点测试。我一直在使用 CocoaRestClient,它包括 JSON 的自动格式化和语法高亮,如您所要求。它是开源的、轻量级的,并且至少得到了开发人员的积极支持:
回答by Mike Brant
I don't know why you care whether the client is in Safari or not. A restful POST should be able to be executed from any sort of client. You might want to look at RESTClient extension for Firefox http://restclient.net/
我不知道你为什么关心客户端是否在 Safari 中。一个安静的 POST 应该能够从任何类型的客户端执行。您可能想查看 Firefox http://restclient.net/ 的RESTClient 扩展
Also just Google 'REST client' you should see plenty of other tools available to generate POST's against your service. If you are really would about Safari-specific responses, most good REST tools, should allow you to set the User-Agent header so as to make the request look like it is coming from Safari.
也只是谷歌“REST 客户端”,您应该会看到许多其他工具可用于针对您的服务生成 POST。如果您真的想要特定于 Safari 的响应,大多数优秀的 REST 工具应该允许您设置 User-Agent 标头,以使请求看起来像是来自 Safari。

