0
using Flurl.Http;
dataMapperSurvey = "url"
var responseJString = await dataMapperSurvey.WithHeader("AUTH_TOKEN", "335351").GetStringAsync();

Here I'm try to hit the url with that specific Auth_token porvided in header.

If I check the response in Postman with POST I get an exception and If I do GET I get proper Response.

I don't know how to do GET request here, Can anyone Help?

Hemant-Webo
  • 543
  • 2
  • 7
  • 16

1 Answers1

1

You've stated that you are receiving a 500 response (usually akin to an unhandled exception) from your own code on the server. This is where you should be focusing your debugging efforts, not on the client side. Assuming you web app is some flavor of ASP.NET that you can run locally in Visual Studio, here's how I'd approach it:

  1. Debug your web app. Either put a breakpoint in the controller or break on all unhandled exceptions.

  2. Investigate the exception details when you call the API with Flurl. Handle the exception and return a 400 (bad request) or something more appropriate, or if it's NOT a bad request, fix the code to handle it correctly.

  3. If it's still unclear why Flurl call behaves differently than Postman, inspect the request from the server (headers, body, etc) and determine what's different.

Community
  • 1
  • 1
Todd Menier
  • 37,557
  • 17
  • 150
  • 173