使用 GET 时是否可以向 LoadVars 添加请求标头(Flash AS2)

发布于 2024-09-29 23:22:22 字数 472 浏览 0 评论 0原文

我正在开发一个用 Flash AS2 构建的项目。

我需要做的事情之一是加载 JSON 数据。

过去,我对此没有任何问题 - LoadVars 工作得很好。

但是,在这个项目中,我调用的 JSON 服务要求 http 请求包含带有“application/json”的 ACCEPT 标头。

LoadVars 有一个 addRequestHeader 方法,允许我添加或更改 HTTP 请求标头,但根据文档,这些标头仅通过 POST 操作发送。

当然,在我的例子中,JSON 服务只允许 GET 请求。

无论如何,我尝试使用 addRequestHeader,但标头未发送。

有办法解决这个问题吗?

(当然,我可以使用 AS3 重建应用程序,这允许我使用 URLLoader 和 URLRequest,但是该应用程序有很多遗留的 AS2 代码...)

非常感谢您提供任何建议或见解。

I'm working on a project built in Flash AS2.

One of the things I need to do is load JSON data.

In the past, I've had no problem with this - LoadVars works just fine.

However, on this project, the JSON service that I'm calling requires the http request to include an ACCEPT header with "application/json".

LoadVars has an addRequestHeader method that allows me to add or change HTTP request headers, but according to the documentation, those headers are only sent with POST actions.

Of course, in my case, the JSON service only allows GET requests.

I tried using addRequestHeader anyway, but the header is not sent.

Is there some way around this?

(Of course, I could rebuild the application using AS3, which allows me to use URLLoader and URLRequest, but the application has WAY to much legacy AS2 code...)

Many thanks in advance for any advice or insight.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

赤濁 2024-10-06 23:22:22

经过 5 个月的研究,答案似乎是明确的“否”。

After 5 months of research, it appears the answer is a definitive "No".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文