Skip to content

How to access data on an array-only CBOR object? #82

@douglasg14b

Description

@douglasg14b

Access to values just throws exceptions: Not A Map

Image

This is CBOR data that is just arrays of arrays, it's not my data type, it's from a 3rd party. I did not seem to have issue parsing it with python or JS available libs, so I assume I may need to access this in some specific way??

This is effectively the schema of the CBOR encoded data, written in typescript, with WrrRawReqResV1 being the entire encoded object.

export type WrrHeader = [
    key: string,
    value: Buffer<ArrayBuffer>
]

export type WrrRawRequestV1 = [
    requestTimeStamp: number,
    requestMethod: string,
    requestURL: string,
    requestHeaders: WrrHeader[],
    isRequestComplete: boolean,
    requestBody: Uint8Array
];

export type WrrRawResponseV1 = null | [
    responseTimeStamp: number,
    responseStatusCode: number,
    responseReason: string,
    responseHeaders: WrrHeader[],
    isResponseComplete: boolean,
    responseBody: Uint8Array
];

export type WrrRawReqResV1 = [
    format: "WEBREQRES/1",
    agent: string,
    protocol: string,
    request: WrrRawRequestV1,
    response: WrrRawResponseV1,
    endTimeStamp: number,
    optionalData: Record<string, unknown>
];

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions