简体   繁体   English

用JSONP内容压缩Web服务响应是否有效?

[英]Is it valid to compress web service responses with JSONP content?

Simple question really, but not one I am able to find clear guidance on. 确实是一个简单的问题,但是我找不到一个明确的指导。 I'm writing web services that support JSONP responses (based on specification of a callback query param), and would like to provide support for compression. 我正在编写支持JSONP响应(基于回调查询参数的规范)的Web服务,并希望提供对压缩的支持。

I raised another question a while back about a possible bug in ServiceStack, but before providing a fix for it, I'm looking for guidance on whether I should be in the first place? 不久前,我又提出了一个有关ServiceStack中可能存在错误的问题,但是在提供此问题的修复程序之前,我正在寻找有关是否应该首先解决问题的指南。

Yes. 是。 Technically JSONP is javascript, not JSON. 从技术上讲,JSONP是javascript,而不是JSON。 Ie it should have application/javascript mimetype . 它应该具有application/javascript mimetype And, just like any other JS resource a web page might request (eg a static foo.js file), it can be compressed. 而且,就像网页可能会请求的其他任何JS资源(例如,静态foo.js文件)一样,可以对其进行压缩。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM