Skip to content

Commit b1afc26

Browse files
committed
chore: get request body
1 parent 62b898d commit b1afc26

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

functions/api/share.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
export async function onRequest(request) {
1+
export async function onRequest(context) {
2+
console.log('json', await context.request.json())
3+
24
const data = {
35
hello: 'world',
46
};
@@ -7,7 +9,7 @@ export async function onRequest(request) {
79

810
return new Response(json, {
911
headers: {
10-
"content-type": "application/json;charset=UTF-8",
12+
'content-type': 'application/json;charset=UTF-8',
1113
},
1214
});
1315
}

src/App.vue

+3-4
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@ const share = () => {
2020
headers: {
2121
'Content-Type': 'application/json'
2222
},
23-
body: '{}'
24-
// JSON.stringify({
25-
// content: content.value
26-
// })
23+
body: JSON.stringify({
24+
content: content.value
25+
})
2726
}).then(res => res.json()).then(res => {
2827
console.log(res)
2928
contentChanged.value = true

0 commit comments

Comments
 (0)