Skip to content

[BUG] / root in browser returns json #532

@Justxd22

Description

@Justxd22

Describe the bug
PR #399 introduce serving NIP-11 on root when headers contain Accept: application/nostr+json but the detection logic is failing for browsers and returning json

headers sent:

GET / HTTP/1.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate, br, zstd
Accept-Language: en-US,en;q=0.8
Cache-Control: max-age=0
Connection: keep-alive
Host: 127.0.0.1:8008
If-None-Match: W/"2cf-yiYUGZLRa1VnCsMoAYdocVUDb08"
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: none
Sec-Fetch-User: ?1
Sec-GPC: 1
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36
sec-ch-ua: "Chromium";v="146", "Not-A.Brand";v="24", "Brave";v="146"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Linux"

To Reproduce
visit 127.0.0.1:8008 in browser

Expected behavior
returns html

Screenshots
Image

System (please complete the following information):

  • OS: arch linux
  • Platform: pnpm
  • Version: latest

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions