I have Apigee Proxy which return texts and URL.
I have used assign message for this purpose where I have set Payload as
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage continueOnError="false" enabled="true" name="AM-SetPayload">
<DisplayName>AM-SetPayload</DisplayName>
<Properties/>
<Set>
<Payload contentType="text">
IBIS World - https://fed.ibisworld.com/marsh
</Payload>
<Verb>GET</Verb>
</Set>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>
When I try this proxy via POSTMAN I link the response.
When I try it via Chrome browser I do not get URL link.
Any idea why it has different behavior.
As per the screenshot of the browser, I see you are getting the URL as text.
I guess is your question is "why the link is not rendered properly (clickable link)" correct? If so, its the behavior of Postman to render the text which has a complete url. For browser, it gets the response content-type as "text" and it follows the descriptor and displays accordingly.
So the difference is in the client tool which processes responses.
Thanks.
^^^ that is the correct answer. However, if you want to have links in response body, why not return JSON and do something like:
{
"links": [{
"name": "my site",
"href": "https://mysite.com/posts/hello.html"
}]
}
then you have the calling app parse and display the links as href tags.
Line 6 is incorrect:
<Payload contentType="text">
This is not a valid Content-Type header. You probably meant the following:
<Payload contentType="text/plain">
Clients parse the Content-Type differently. You should always use a well-known, valid contentType in your configuration. Postman will detect a URL and make it a hyperlink automatically. A browser will not do this.
If you are expecting a link that a browser can interpret, then you make want to modify your Payload to include an HTML hyperlink instead, like:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage continueOnError="false" enabled="true" name="AM-SetPayload">
<DisplayName>AM-SetPayload</DisplayName>
<Properties/>
<Set>
<Payload contentType="text/html">
<a href="https://fed.ibisworld.com/marsh">IBIS World</a>
</Payload>
<Verb>GET</Verb>
</Set>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |