sp-rest-proxy: Incorrect proxying of WebFaultException
I have custom WCF REST service, hosted in SharePoint. I’m using sp-rest-proxy to test application wich make a request to SharePoint REST API and this custom service.
Everything goes great unless WCR REST service throws an exception.
throw new WebFaultException<string>(ex.ToString(), HttpStatusCode.InternalServerError)
When this code executes, direct GET request returns string response with exception (ex.ToString()).
When I make request through proxy, I got json response with something like that:
{ "type": "Buffer", "data": [ 34, 83, 121, 115, 116, 101, 109, 46, 65, 114, 103, 117, 109, 101 ]}
It’s very inconvenient because I can’t test exception handling in developer enviroment with sp-rest-proxy, I need to deploy my application to test that behaviour. If it can be fixed, please do it. Thank you!
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 19 (9 by maintainers)
Cool! Glad it works for you now. Please use the beta until I’ll publish the new version with latest tag after a little while.
Hey @koltyakov! Sorry, it was my fault. Double checked proxy config and realized I changed SharePoint address to another farm. Now it works perfectly! Many thanks, I think issue can be closed now.
@koltyakov sorry for late reply. I had some issue with npm while updating to beta version, then got distracted by other tasks. Now I got an error when I try to
npm run proxy
I will try to do some troubleshooting and will be back to you with updates.
SpRestProxy.zip Without proxy:
With proxy:

As you can see, I’m just throwing an exception in code, nothing more:
@koltyakov sure, will create a sample project for it. To make it clear, it works when it’s executes without exception. Issue only with WebFaultException. I’ll be back with example project.