Skip to content

Remove implicit Content-Type conversion #9

Open
@mary-ext

Description

This line of code is problematic

if (responseType) {
if (responseType.startsWith('application/json')) {
promise = response.json();
} else if (responseType.startsWith('text/')) {
promise = response.text();
}
}
try {
ret = await (promise || response.arrayBuffer().then((buffer) => new Uint8Array(buffer)));
} catch (err) {

We should always assume XRPC to return JSON, if the lexicon specifies returning anything other than JSON, then we should make this explicit in the types.

const { data } = await rpc.get('com.atproto.sync.getBlob', {
  // this is required, must be `json`, `blob` or `bytes`
  as: 'blob',
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    breaking changeIssues that involve doing a breaking change

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions