Correctly parse actors with an empty endpoints object

Closes #3
parent 20606306
Pipeline #162 passed with stage
in 50 seconds
{"@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1", {"Hashtag": "as:Hashtag", "sensitive": "as:sensitive", "manuallyApprovesFollowers": "as:manuallyApprovesFollowers", "toot": "http://joinmastodon.org/ns#", "featured": "toot:featured", "schema": "http://schema.org#", "PropertyValue": "schema:PropertyValue", "value": "schema:value"}], "type": "Person", "id": "https://microblog.pub", "following": "https://microblog.pub/following", "followers": "https://microblog.pub/followers", "featured": "https://microblog.pub/featured", "liked": "https://microblog.pub/liked", "inbox": "https://microblog.pub/inbox", "outbox": "https://microblog.pub/outbox", "preferredUsername": "dev", "name": "microblog.pub", "summary": "<p>A self-hosted, single-user, ActivityPub powered microblog.</p><p>I also post notes as <a href=\"https://a4.io/\">@t@a4.io</a>.</p>", "endpoints": {}, "url": "https://microblog.pub", "manuallyApprovesFollowers": false, "attachment": [], "icon": {"mediaType": "image/png", "type": "Image", "url": "https://sos-ch-dk-2.exo.io/microblogpub/microblobpub.png"}, "publicKey": {"id": "https://microblog.pub#main-key", "owner": "https://microblog.pub", "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtHHqAU8po8Trk19HxCCL\nV1xC3MBOFbcn+Pv3fXP8+OtF/o2SujDyUeUkuOHjI7cqQLqehcNUHLxKF0T6IDiY\niqpjpqolCz4c2dY0Ze6tNpb80ftOUqwxl4e/hggFvYAmT5lNMinwEmX35l7AFrJO\nDHgK2Copv5UMgP/UNL1CqCYhqcIXhey9qLBI6FBo19rPSghMF3GJqXGg3ww7VT6o\nZA1q/G6rCo+SoiY4e9b77xNKYa8OauTT/e9/112+DxdemXJqMfhbYTsKdMQ8fs9B\nLyl2P9M+xVNHUl+CFoiyMAkID6hPMWbwlPY6BxDmteWRtNDZPcptGgN5FlAHB7PX\nMO4sg+2YVpCGizTSy3AvPmQQkUJTYi59ZadLjWrA5vax1lwIlWcRoq8XD0DyQeRB\nZEdpUrsy8N21Zjv8TyVoUvBW4Uid+T0l355Z3dqbBkGNwzcQuidFeRYJAU57bVwp\noPxvHuDXbGfnXfhPCHk47OqTjGOPQZCLMWLz2Lo+Ez1YFsEsLzecKp2R1KZIPO3t\ndHTCo+8BnBuE/5+P4yma1tOZKbataotvl2V+JWGJBNnHSMI0WUKyngUNxneJCOo9\nQ8MPN/Y4INQGzSoT4GWUt43gljxHZrwcDvqh2wBsPp/8l5hgwOfPyWQrKb1Lzg/3\nRxr7oYSF1MucUcscnYFmb7ECAwEAAQ==\n-----END PUBLIC KEY-----"}}
\ No newline at end of file
......@@ -86,6 +86,13 @@ describe InboxHandler do
end
end
it "succeeds with empty endpoints object" do
File.open("spec/data/actor_empty_endpoints.json") do |file|
actor = Union(InboxHandler::Actor, InboxHandler::Key).from_json(file).as(InboxHandler::Actor)
actor.inbox_url.should eq("https://microblog.pub/inbox")
end
end
it "fails with no request body" do
WebMock.wrap do
WebMock.stub("GET", "https://example.com/key")
......
......@@ -234,7 +234,7 @@ class InboxHandler
include JSON::Serializable
@[JSON::Field(key: "sharedInbox")]
getter shared_inbox : String
getter shared_inbox : String?
end
private def error(status_code, message)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment