-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/ucp-migration
- Loading branch information
Showing
7 changed files
with
108 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,48 @@ | ||
import { fetch } from 'cross-fetch' | ||
|
||
const container = "http://localhost:3000/alice/public/" | ||
const slug = "resource.txt" | ||
const container = "http://localhost:3000/alice/public/"; | ||
const slug = "resource.txt"; | ||
const body = "This is a resource."; | ||
|
||
async function main() { | ||
|
||
console.log("=== Creating container (if needed) ...") | ||
console.log(`=== PUT container <${container}>\n`); | ||
|
||
const containerResponse = await fetch(container, { | ||
method: "PUT", | ||
}) | ||
|
||
console.log(`= Status: ${containerResponse.status}`); | ||
console.log(`= Status: ${containerResponse.status}\n`); | ||
console.log('\n'); | ||
|
||
console.log("=== Creating resource ...") | ||
console.log(`=== POST to <${container}> with slug '${slug}': "${body}"\n`) | ||
|
||
const createResponse = await fetch(container, { | ||
method: "POST", | ||
headers: { slug }, | ||
body: "This is a resource." | ||
body | ||
}) | ||
|
||
console.log(`= Status: ${createResponse.status}`); | ||
console.log(`= Status: ${createResponse.status}\n`); | ||
console.log('\n'); | ||
|
||
console.log("=== Creating resource ...") | ||
console.log(`=== GET <${container + slug}>\n`); | ||
|
||
const readResponse = await fetch(container + slug, { | ||
method: "GET", | ||
}) | ||
|
||
console.log(`= Status: ${readResponse.status}`); | ||
console.log(`= Body: \n${await readResponse.text()}`); | ||
|
||
console.log("=== Deleting resource ...") | ||
console.log(`= Status: ${readResponse.status}\n`); | ||
console.log(`= Body: "${await readResponse.text()}"\n`); | ||
console.log('\n'); | ||
|
||
console.log(`=== DELETE <${container + slug}>\n`); | ||
|
||
const deleteResponse = await fetch(container + slug, { | ||
method: "DELETE", | ||
}) | ||
|
||
console.log(`= Status: ${deleteResponse.status}`); | ||
|
||
console.log(`= Status: ${deleteResponse.status}\n`); | ||
} | ||
|
||
main(); | ||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters