简体   繁体   English

WSO2:如何通过中介保留HTTP标头中的Content-Type

[英]WSO2 : how to preserve Content-Type in http header with mediation

I'm using wso2am with 1.10.0 version. 我正在将wso2am与1.10.0版本一起使用。

I have a API (Content-Type: multipart/form-data) 我有一个API(内容类型:multipart / form-data)
but when request invoked, endpoint(real api server) can't receive Content-Type header. 但是当调用请求时,端点(真实api服务器)无法接收Content-Type标头。

I found a solution. 我找到了解决方案。
http://prabu-lk.blogspot.kr/2015/09/how-to-preserving-http-headers-in-wso2.html http://prabu-lk.blogspot.kr/2015/09/how-to-preserving-http-headers-in-wso2.html
but this solution is a global setting. 但是此解决方案是一个全局设置。

The reason I can not use this solution is because of the other api. 我无法使用此解决方案的原因是由于其他API。
This api changes the content-type in customhandler. 此api更改customhandler中的content-type。

So i want use mediation to be applied in units of api. 所以我想使用中介以api为单位进行应用。

If you know how to fix it, please help me. 如果您知道如何解决,请帮助我。

Have you tried to add a custom sequence to API and set the header from there? 您是否尝试过向API添加自定义序列并从那里设置标头?

Refer document here for more info. 有关更多信息,请参见此处的文档。 This should add as an in-sequence. 这应该作为一个顺序添加。

Your sequence should look like this. 您的序列应如下所示。

<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="header-sequence">
  <header name="Content-Type" value="multipart/form-data"/>
</sequence>

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

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