My current challenge involves making a POST request to an endpoint that requires query string parameters instead of passing them in the body of the request.
const params = new HttpParams()
.set('param1', '1')
.set('param2', '2');
const url = environment.apiUrl + 'Service/Endpoint';
return this
.httpClient
.post<ServiceResponse>(url, { params })
.pipe(map(res => res.httpStatusCodeSuccess));
Despite my efforts, I continue to receive a 404 error because the call does not contain any query string parameters. This was confirmed by analyzing the network activity.
Interestingly, the same code works perfectly for GET requests when using .get()
, but encounters issues with .post()
against a POST endpoint. What could be the missing piece in this puzzle?