Skip to content

Commit

Permalink
fix(docs): don't merge payloads for PUT requests (#740)
Browse files Browse the repository at this point in the history
  • Loading branch information
kanadgupta authored Jan 31, 2023
1 parent d311af9 commit e3c7f22
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 17 deletions.
2 changes: 0 additions & 2 deletions __tests__/cmds/changelogs/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ describe('rdme changelogs', () => {

const updateMocks = getAPIMock()
.put('/api/v1/changelogs/simple-doc', {
slug: simpleDoc.slug,
body: simpleDoc.doc.content,
lastUpdatedHash: simpleDoc.hash,
...simpleDoc.doc.data,
Expand All @@ -101,7 +100,6 @@ describe('rdme changelogs', () => {
body: simpleDoc.doc.content,
})
.put('/api/v1/changelogs/another-doc', {
slug: anotherDoc.slug,
body: anotherDoc.doc.content,
lastUpdatedHash: anotherDoc.hash,
...anotherDoc.doc.data,
Expand Down
1 change: 0 additions & 1 deletion __tests__/cmds/changelogs/single.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ describe('rdme changelogs (single)', () => {

const updateMock = getAPIMock()
.put('/api/v1/changelogs/simple-doc', {
slug: simpleDoc.slug,
body: simpleDoc.doc.content,
lastUpdatedHash: simpleDoc.hash,
...simpleDoc.doc.data,
Expand Down
2 changes: 0 additions & 2 deletions __tests__/cmds/custompages/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ describe('rdme custompages', () => {

const updateMocks = getAPIMock()
.put('/api/v1/custompages/simple-doc', {
slug: simpleDoc.slug,
body: simpleDoc.doc.content,
htmlmode: false,
lastUpdatedHash: simpleDoc.hash,
Expand All @@ -103,7 +102,6 @@ describe('rdme custompages', () => {
body: simpleDoc.doc.content,
})
.put('/api/v1/custompages/another-doc', {
slug: anotherDoc.slug,
body: anotherDoc.doc.content,
htmlmode: false,
lastUpdatedHash: anotherDoc.hash,
Expand Down
1 change: 0 additions & 1 deletion __tests__/cmds/custompages/single.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ describe('rdme custompages (single)', () => {

const updateMock = getAPIMock()
.put('/api/v1/custompages/simple-doc', {
slug: simpleDoc.slug,
body: simpleDoc.doc.content,
htmlmode: false,
lastUpdatedHash: simpleDoc.hash,
Expand Down
4 changes: 0 additions & 4 deletions __tests__/cmds/docs/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ describe('rdme docs', () => {

const updateMocks = getAPIMockWithVersionHeader(version)
.put('/api/v1/docs/simple-doc', {
category,
slug: simpleDoc.slug,
body: simpleDoc.doc.content,
lastUpdatedHash: simpleDoc.hash,
...simpleDoc.doc.data,
Expand All @@ -152,8 +150,6 @@ describe('rdme docs', () => {
body: simpleDoc.doc.content,
})
.put('/api/v1/docs/another-doc', {
category,
slug: anotherDoc.slug,
body: anotherDoc.doc.content,
lastUpdatedHash: anotherDoc.hash,
...anotherDoc.doc.data,
Expand Down
2 changes: 0 additions & 2 deletions __tests__/cmds/docs/single.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,6 @@ describe('rdme docs (single)', () => {

const updateMock = getAPIMockWithVersionHeader(version)
.put('/api/v1/docs/simple-doc', {
category,
slug: simpleDoc.slug,
body: simpleDoc.doc.content,
lastUpdatedHash: simpleDoc.hash,
...simpleDoc.doc.data,
Expand Down
6 changes: 1 addition & 5 deletions src/lib/syncDocsPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,7 @@ async function pushDoc(
'Content-Type': 'application/json',
})
),
body: JSON.stringify(
Object.assign(existingDoc, {
...payload,
})
),
body: JSON.stringify(payload),
})
.then(handleRes)
.then(res => `✏️ successfully updated '${res.slug}' with contents from ${filepath}`);
Expand Down

0 comments on commit e3c7f22

Please sign in to comment.