Skip to content

Commit

Permalink
VS-269: Add content-type header to Vectorize POST operations
Browse files Browse the repository at this point in the history
  • Loading branch information
garvit-gupta committed Aug 21, 2024
1 parent f6ace9f commit fc3636b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/rare-cooks-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

fix(6516): Add content-type header to Vectorize POST operations
16 changes: 15 additions & 1 deletion packages/wrangler/src/vectorize/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ export async function queryIndex(
`/accounts/${accountId}/vectorize/v2/indexes/${indexName}/query`,
{
method: "POST",
headers: { "Content-Type": "application/json" },
headers: {
"content-type": jsonContentType,
},
body: JSON.stringify({
...options,
vector: Array.isArray(vector) ? vector : Array.from(vector),
Expand All @@ -161,6 +163,9 @@ export async function getByIds(
`/accounts/${accountId}/vectorize/v2/indexes/${indexName}/get_by_ids`,
{
method: "POST",
headers: {
"content-type": jsonContentType,
},
body: JSON.stringify(ids),
}
);
Expand All @@ -177,6 +182,9 @@ export async function deleteByIds(
`/accounts/${accountId}/vectorize/v2/indexes/${indexName}/delete_by_ids`,
{
method: "POST",
headers: {
"content-type": jsonContentType,
},
body: JSON.stringify(ids),
}
);
Expand Down Expand Up @@ -207,6 +215,9 @@ export async function createMetadataIndex(
`/accounts/${accountId}/vectorize/v2/indexes/${indexName}/metadata_index/create`,
{
method: "POST",
headers: {
"content-type": jsonContentType,
},
body: JSON.stringify(payload),
}
);
Expand Down Expand Up @@ -237,6 +248,9 @@ export async function deleteMetadataIndex(
`/accounts/${accountId}/vectorize/v2/indexes/${indexName}/metadata_index/delete`,
{
method: "POST",
headers: {
"content-type": jsonContentType,
},
body: JSON.stringify(payload),
}
);
Expand Down

0 comments on commit fc3636b

Please sign in to comment.