Global Feed Post Login
Replying to Avatar jimbocoin 🃏

Question about #Nostr NIP-11:

The NIP specifies that relays should respond with the relay document when receiving a request with the 'Accept' header set to 'application/nostr+json'.

Should the response have a 'Content-Type' header of 'application/nostr+json' also? OR should the 'Content-Type' be the simpler 'application/json'.

My guess would be the former. The HTTP client said it would Accept 'application/nostr+json', so it makes sense to send a Content Type of 'application/nostr+json'. However, I'm finding that some tools don't recognize the 'application/nostr+json' content type header.

In my case, I'm using the MockResponse class from the 'node-mocks-http' npm package. The response._isJSON() method returns true for 'application/json' but false for 'application/nostr+json'.

https://github.com/nostr-protocol/nips/blob/master/11.md

12
Carlos 2y ago

The NIP has an example command with curl:

curl -H "Accept: application/nostr+json" https://eden.nostr.land

If the client says it accepts content of type `application/nostr+json`, seems reasonable to expect the relay should respond with exactly that content type header.

Reply to this note

Please Login to reply.

Discussion

Avatar
jimbocoin 🃏 2y ago

Yeah, that’s what I decided. As well. 🤝

Only remaining question is whether to tack on a “charset=utf-8”. I’m thinking no on that, but any HTTP compliant client should be able to handle it either way.

Thread collapsed