mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-02 03:52:25 -06:00
start refactoring return codes from fedi endpoints, remove some cruft
This commit is contained in:
parent
c6044d0142
commit
47051a26d6
28 changed files with 346 additions and 291 deletions
|
|
@ -217,17 +217,21 @@ func (f *Federator) AuthenticatePostInbox(ctx context.Context, w http.ResponseWr
|
|||
pubKeyAuth, errWithCode := f.AuthenticateFederatedRequest(ctx, receivingAccount.Username)
|
||||
if errWithCode != nil {
|
||||
switch errWithCode.Code() {
|
||||
case http.StatusUnauthorized, http.StatusForbidden, http.StatusBadRequest:
|
||||
// If codes 400, 401, or 403, obey the go-fed
|
||||
// interface by writing the header and bailing.
|
||||
|
||||
// If codes 400, 401, or 403, obey the go-fed
|
||||
// interface by writing the header and bailing.
|
||||
case http.StatusUnauthorized,
|
||||
http.StatusForbidden,
|
||||
http.StatusBadRequest:
|
||||
w.WriteHeader(errWithCode.Code())
|
||||
|
||||
// If the requesting account's key has gone
|
||||
// (410) then likely inbox post was a Delete.
|
||||
//
|
||||
// We can just write 202 and leave: we didn't
|
||||
// know about the account anyway, so we can't
|
||||
// do any further processing.
|
||||
case http.StatusGone:
|
||||
// If the requesting account's key has gone
|
||||
// (410) then likely inbox post was a delete.
|
||||
//
|
||||
// We can just write 202 and leave: we didn't
|
||||
// know about the account anyway, so we can't
|
||||
// do any further processing.
|
||||
w.WriteHeader(http.StatusAccepted)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue