Skip to content

Spec/test mismatch #260

@achingbrain

Description

@achingbrain

This test is executed as:

GET UnixFS with 'Accept: application/json' (not dag-json) is no-op (no conversion)

The CID used in the test is a RAW codec CID, bafkreialihlqnf5uwo4byh4n3cmwlntwqzxxs2fg5vanqdi3d7tb2l5xkm, that resolves to this block.

The test:

  1. Requests a RAW codec CID
  2. Sends an Accept: application/json header
  3. Expects a Content-Type: text/plain response header
  4. Asserts that the body is the raw block

The spec says of Accept: application/json:

application/json – same as application/vnd.ipld.dag-json, unless the CID’s codec already is json (0x0200). Then, the raw JSON block can be returned as-is without any conversion.

The CID's codec is not JSON, so we refer to the application/vnd.ipld.dag-json Accept header:

application/vnd.ipld.dag-json – requests IPLD Data Model representation serialized into DAG-JSON format. If the requested CID already has dag-json (0x0129) codec, data is validated as DAG-JSON before being returned as-is. Invalid DAG-JSON produces HTTP Error 500.

The CID codec is RAW, so it's an opaque block of bytes and we don't validate it as DAG-JSON. The IPLD Data Model representation of a byte array as JSON is { "/": { "bytes": "...base64" } } but the test is expecting the raw block content with a content type not in the accept header.

The test seems to want us to:

  1. Ignore the Accept header
  2. Use mime-type sniffing to determine the returned content type?

This doesn't seem to follow the spec, or am I missing something?

Related: #200

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions