I have a C# post method :
[HttpPost("signup")]
public async Task<IActionResult> Signup([FromBody] User user)
using swagger:
request url: https://localhost:7095/Auth/signup
payload:
curl -X 'POST' \
'https://localhost:7095/Auth/signup' \
-H 'accept: */*' \
-H 'Content-Type: application/json' \
-d '{
"userId": 0,
"firstname": "string",
"surname": "string",
"email": "string",
"sex": "string",
"dateOfBirth": "2023-04-03T18:32:08.405Z",
"password": "string",
"username": "string"
}'
On my Angular 14 side:
I get to my add method:
add<T>(data: any, apiMethod: string): Observable<T> | undefined {
let callPoint = this.endpoint.concat('/', apiMethod);
console.log(callPoint);
try {
var tt = this.httpClient.post<T>(callPoint, JSON.stringify(data), this.httpHeader);
return tt;
} catch (e) {
console.log(e);
}
return;
}
From the first console.log I can see that My end point matches the endpoint in my curl command, and my headers match. I'm also passing a user payload:
with a breakpoint on return tt I have:
and if I drill down to the headers part in the console window I have:
The call doesn't fail. it never reaches my endpoint. If I go to the network tab in the browser, there is no entry there.
I thought it might be a CORS policy on my WebApi side, but then I should still see a failure and an attempt to reach the endpoint, but I dont. has anybody an idea why I'm not getting out to the end point?