mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[bugfix] Don't return Internal Server Error when searching for URIs that don't return AP JSON (#2550)
* [bugfix] Don't return Internal Server Error when searching for URIs that don't return AP JSON * don't pass map pointer
This commit is contained in:
@@ -47,6 +47,29 @@ func (suite *ResolveTestSuite) TestResolveDocumentAsAccountable() {
|
||||
suite.Nil(accountable)
|
||||
}
|
||||
|
||||
func (suite *ResolveTestSuite) TestResolveHTMLAsAccountable() {
|
||||
b := []byte(`<!DOCTYPE html>
|
||||
<title>.</title>`)
|
||||
|
||||
accountable, err := ap.ResolveAccountable(context.Background(), b)
|
||||
suite.True(gtserror.IsWrongType(err))
|
||||
suite.EqualError(err, "ResolveAccountable: error unmarshalling bytes into json: invalid character '<' looking for beginning of value")
|
||||
suite.Nil(accountable)
|
||||
}
|
||||
|
||||
func (suite *ResolveTestSuite) TestResolveNonAPJSONAsAccountable() {
|
||||
b := []byte(`{
|
||||
"@context": "definitely a legit context muy lord",
|
||||
"type": "definitely an account muy lord",
|
||||
"pee pee":"poo poo"
|
||||
}`)
|
||||
|
||||
accountable, err := ap.ResolveAccountable(context.Background(), b)
|
||||
suite.True(gtserror.IsWrongType(err))
|
||||
suite.EqualError(err, "ResolveAccountable: error resolving json into ap vocab type: activity stream did not match any known types")
|
||||
suite.Nil(accountable)
|
||||
}
|
||||
|
||||
func TestResolveTestSuite(t *testing.T) {
|
||||
suite.Run(t, &ResolveTestSuite{})
|
||||
}
|
||||
|
Reference in New Issue
Block a user