Once an HTTP request is sent to the server, it cannot be canceled as expected. The server will still attempt to fulfill the request even if you disregard the response.
However, there are scenarios where a streaming HTTP request can be terminated or when using two separate HTTP requests to start and cancel a job on the server can emulate cancellation (although this involves successful completion of both requests).
If looking for alternatives, consider exploring throttling or debouncing in JavaScript. These techniques ensure that a function is only called once per keypress, based on certain conditions like not being called within a specific time frame.
[UPDATE] While some tools allow for the "cancellation" of in-flight HTTP requests (like rxjs), keep in mind that this may not prevent the server from processing the call if it has already been received. Additionally, the ability to cancel requests depends on your specific HTTP implementation. More information can be found here.