Skip to content

Commit

Permalink
Stringify and use res text
Browse files Browse the repository at this point in the history
  • Loading branch information
aryzing committed Oct 15, 2024
1 parent f7924ed commit eec13f9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/stacks-rpc-api/smart-contracts/map-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ export async function mapEntry(args: Args): Promise<Result<MapEntryResponse>> {
};
}
init.method = "POST";
init.body = args.mapKey.startsWith("0x") ? args.mapKey : `0x${args.mapKey}`;
init.body = JSON.stringify(
args.mapKey.startsWith("0x") ? args.mapKey : `0x${args.mapKey}`,
);
init.headers = { ...init.headers, "Content-Type": "application/json" };

const endpoint = `${args.baseUrl}/v2/map_entry/${args.contractAddress}/${args.contractName}/${args.mapName}?${search}`;
const res = await fetch(endpoint, init);
Expand All @@ -47,10 +50,11 @@ export async function mapEntry(args: Args): Promise<Result<MapEntryResponse>> {
name: "FetchMapEntryError",
message: "Failed to fetch map entry.",
data: {
init,
status: res.status,
statusText: res.statusText,
endpoint,
bodyParseResult: await safePromise(res.json()),
bodyParseResult: await safePromise(res.text()),
},
});
}
Expand Down

0 comments on commit eec13f9

Please sign in to comment.