nodeSolidServer / nodeSolidServer/node-solid-server

POST does not work the way it did in 4.x

Open
#1,246 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue test-case
Dominant language
JavaScript
Stars
1.8k
Forks
308
PR merge metrics
No merged PRs in 30d

Description

From my testing (test attached below) I notice these differences:

POST "foo", no content-type                                                     
  4.x : "foo" text/turtle                                                       
  5.x : 500                                                                     
POST "foo.ttl", no content-type                                                 
  4.x : "foo.ttl" text/turtle                                                   
  5.x : 500                                                                     
POST "foo", content-type=text/turtle                                            
  4.x : "foo"     text/turtle                                                   
  5.x : "foo.ttl" text/turtle                                                   
POST "foo.ttl", content-type=text/turtle                                        
  4.x : "foo.ttl.ttl" text/turtle                                               
  5.x : "foo.ttl.ttl" text/turtle                                               

Here's the test. I ran it against solid.community for 5.x and against solid.openlinksw.com:8444 for 4.x

const auth       = require('solid-auth-cli')
const text       = "<> a <#test>."

const idp  = "https://jeffz.solid.community"
const base = idp + "/public/nss5-test/"
const file = "test-file"

async function main(){
  let session = await auth.login()
  console.log("Logged in as <"+session.webId+">")
  console.log("Using folder <"+base+">\n")
  await test({
     label       : "POST, no content-type",
     extension   : "",
     contentType : ""
  })
  await test({
     label       : "POST content-type=text/turtle",
     extension   : "",
     contentType : "text/turtle"
  })
  await test({
     label       : "POST, no content-type",
     extension   : ".ttl",
     contentType : ""
  })

}
async function test(opts){
  let url = file + opts.extension
  console.log("    ",opts.label,"<"+url+">")
  let headers = {
    link : '<http://www.w3.org/ns/ldp#Resource>; rel="type"',
    slug : url,
  }
  if(opts.contentType) headers["Content-type"]=opts.contentType
  let res = await auth.fetch( base, {
    method:"POST",
    body:text,
    headers:headers
  })
  if(!res.ok){
    console.log("        ",res.status,res.statusText)
    return
  }
 let location = idp + res.headers.get("location")
 res = await auth.fetch( location )
 location = location.replace(base,'')
 if(res.ok) console.log(
      "        ",
    res.status,
    res.headers.get("content-type"),
    location
  )
  else console.log("        ",res.status,res.statusText)
}
main()

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the supplied Node.js test against the server's POST endpoint and compare the status, Location, and content-type results for each filename and header combination. Done means the 5.x behavior is corrected or explicitly aligned with the 4.x results shown in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.