twitchax / AspNetCore.Proxy

ASP.NET Core Proxies made easy.
MIT License
505 stars 80 forks source link

String escaped JSON structure - POST/PUT fails silently #67

Open sondreb opened 3 years ago

sondreb commented 3 years ago

Thanks for a great library! I have used it previously, and now I'm working on a different project and I have been unable to get it working with POST/PUT when the data structure includes string escaped JSON structure.

I don't have time to reproduce right now, but I'll make one another time as I just found a solution and need to do some other work. I replaced the proxy library with a very basic IHttpClientFactory usage and now it works.

It's basically a body payload that looks like this:

{
    "id": "d8223bbe-29d5-48aa-9510-9be9af965062",
    "content": "{\"category\":\"messages\",\"title\":\"This does not work\",\"content\":\"No fun...\"}"
}

The endpoint this is sent to is another .NET Core API exposed through API Management. Might be some issues there that causes this, but it works from Postman and it works from IHttpClientFactory, so I don't think the issue is there.

twitchax commented 3 years ago

Interesting. If you have a chance to PR a failing test, that would be super helpful. :)

sondreb commented 3 years ago

I will, but I have refactored the implementation to not perform string-escaped JSON and it caused similar issues. So this is likely more an problem with Azure Application Gateway / Azure API Management. I will investigate further soon.

twitchax commented 3 years ago

Hmmm, that is even weirder.