User login through JSON request returning HTML instead of JSON I am using Drupal 8.6.4

http://example.org/user/login?_format=json


When I try to submit a post request, it returns HTML page instead of JSON response.

I am sending headers:

  Content-Type: application/json


and data as: 

 { "name": "admin" , "pass": "admin" }


What am I missing?
It turned out that the Redirect after login module was redirecting to the given URL, which resulted in HTML being output. I have disabled that and now I am getting the proper JSON response.