Hotfix: Remove extra JSON.stringify in Monogo update code path (#119)

This commit is contained in:
Steve Faulkner 2020-07-28 15:13:48 -05:00 committed by GitHub
parent aea168c893
commit dab6e43d0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 8 deletions

View File

@ -1,9 +1,13 @@
name: CI
on:
push:
branches: [master]
branches:
- master
- hotfix/*
- release/*
pull_request:
branches: [master]
branches:
- master
jobs:
compile:
runs-on: ubuntu-latest
@ -184,7 +188,7 @@ jobs:
NODE_TLS_REJECT_UNAUTHORIZED: 0
nuget:
name: Publish Nuget
if: github.ref == 'refs/heads/master'
if: github.ref == 'refs/heads/master' || contains(github.ref, 'hotfix/') || contains(github.ref, 'release/')
needs: [lint, format, compile, build, unittest, endtoendemulator, endtoendsql, endtoendmongo]
runs-on: ubuntu-latest
env:
@ -208,7 +212,7 @@ jobs:
path: "*.nupkg"
nugetmpac:
name: Publish Nuget MPAC
if: github.ref == 'refs/heads/master'
if: github.ref == 'refs/heads/master' || contains(github.ref, 'hotfix/') || contains(github.ref, 'release/')
needs: [lint, format, compile, build, unittest, endtoendemulator, endtoendsql, endtoendmongo]
runs-on: ubuntu-latest
env:

View File

@ -173,7 +173,7 @@ describe("MongoProxyClient", () => {
});
it("builds the correct URL", () => {
updateDocument(databaseId, collection, documentId, {});
updateDocument(databaseId, collection, documentId, "{}");
expect(window.fetch).toHaveBeenCalledWith(
"https://main.documentdb.ext.azure.com/api/mongo/explorer?db=testDB&coll=testCollection&resourceUrl=bardb%2FtestDB%2Fdb%2FtestCollection%2Fdocs%2FtestId&rid=testId&rtype=docs&sid=&rg=&dba=foo&pk=pk",
expect.any(Object)
@ -182,7 +182,7 @@ describe("MongoProxyClient", () => {
it("builds the correct proxy URL in development", () => {
config.MONGO_BACKEND_ENDPOINT = "https://localhost:1234";
updateDocument(databaseId, collection, documentId, {});
updateDocument(databaseId, collection, documentId, "{}");
expect(window.fetch).toHaveBeenCalledWith(
"https://localhost:1234/api/mongo/explorer?db=testDB&coll=testCollection&resourceUrl=bardb%2FtestDB%2Fdb%2FtestCollection%2Fdocs%2FtestId&rid=testId&rtype=docs&sid=&rg=&dba=foo&pk=pk",
expect.any(Object)

View File

@ -206,7 +206,7 @@ export function updateDocument(
databaseId: string,
collection: Collection,
documentId: DocumentId,
documentContent: unknown
documentContent: string
): Promise<DataModels.DocumentId> {
const databaseAccount = CosmosClient.databaseAccount();
const resourceEndpoint = databaseAccount.properties.mongoEndpoint || databaseAccount.properties.documentEndpoint;
@ -230,7 +230,7 @@ export function updateDocument(
return window
.fetch(`${endpoint}?${queryString.stringify(params)}`, {
method: "PUT",
body: JSON.stringify(documentContent),
body: documentContent,
headers: {
...defaultHeaders,
...authHeaders(),