Created
May 24, 2019 08:12
-
-
Save linonetwo/e612315dbbf794a949b998df2247bf7c to your computer and use it in GitHub Desktop.
Head Fields in HTTP #protocol
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
/** slug field: let parent folder create a resource named ${slug} */ | |
const slug = basename(url); | |
const parentFolder = dirname(pathName); | |
const parentUrl = `https://${hostName}${parentFolder}`; | |
/** link field: links saparated by comma, and key-value saparated by semicolon; | |
* type means the suggested content-type, describedby means the suggested meatdata file | |
*/ | |
const link = `<http://www.w3.org/ns/ldp#Resource>; rel="type", <${slug}.meta>; rel="describedby"`; | |
const creationResponse: Response = await fetch(parentUrl, { | |
method: 'POST', | |
headers: { link, slug, 'content-type': contentType }, | |
body: content, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment