fix webfinger responses according to the specs (#2397)
* webfinger query with no resource should get 400 * check valid webfinger query * test webfinger query ... without acct: or with wrong server * add test for invalid user query from webfinger * reorder the tests to decouple from state cleanup
This commit is contained in:
@@ -30,6 +30,7 @@ func WebfingerHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
userComponents := strings.Split(account, "@")
|
||||
if len(userComponents) < 2 {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
host := userComponents[1]
|
||||
@@ -46,7 +47,7 @@ func WebfingerHandler(w http.ResponseWriter, r *http.Request) {
|
||||
// should be rejected.
|
||||
instanceHostString := data.GetServerURL()
|
||||
if instanceHostString == "" {
|
||||
w.WriteHeader(http.StatusNotImplemented)
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user