Simulated login returns 301?

  node.js, question

I simulated logging into segmenfault and returned such header information to me.

HEADERS: {“content-length”:”0″,”location”:”https://segmentfault.com/api/user/login? _=e621fe4ba52123afcf01eebce7a26267″,”connection”:”close”}

What is this? How? Is the parameter not correctly set? The request header is the request header for copying login here

I tried the program, there are several places to pay attention to:
1. The request method must bePOST
2.Content-TypeThe request header is set toapplication/x-www-form-urlencoded
There is one after the interface address._=xxxParameter of, required, otherwise 404 (F12 input the wrong password to copy the parameters)
4.CookieRequest header, required, otherwise report 404 (F12 copy one lump)
5.RefererRequest header must behttps://segmentfault.com/First, required, otherwise 404

This is the wrong account password, returnJSONFormat
图片描述

Decoded error message
图片描述

Successful login returns directlyHTMLString
图片描述