Christian Alderson
Christian Alderson

Reputation: 71

Can delete requests be tested from browser?

I'm currently learning about REST APIs and Spring Boot. I heard in a YouTube tutorial that DELETE requests can't be tested from a browser and can only be tested from applications like Postman. But on testing my code from Firefox, it worked fine. Can someone elaborate on this? Code looks like this.

@DeleteMapping("/employees")
    public String deleteEmployee(@RequestParam("id") Long id) {
        return "Deleting the employee details for the id " + id;
    }

Upvotes: 1

Views: 834

Answers (1)

Sukhmeet Sethi
Sukhmeet Sethi

Reputation: 713

DELETE requests can't be tested from a browser

It means that if you directly paste the URL in browser's address bar, it defaults to GET method. So DELETE or POST or PUT can't be tested by just invoking a URL from browser.

But you can still use browser plugins or tools like Postman or Insomnia to choose the HTTP Method you want to invoke.

Upvotes: 1

Related Questions