nodeSolidServer / nodeSolidServer/node-solid-server

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

未关闭
#1,246 10 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

good first issue test-case
主要语言
JavaScript
星标
1.8k
派生
308
PR 合并指标
30 天内没有已合并 PR

描述

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()

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先,针对服务器的 POST 端点运行所提供的 Node.js 测试,并比较每种文件名和标头组合的 status、Location 和 content-type 结果。当 5.x 的行为得到修正,或明确与 issue 中显示的 4.x 结果保持一致时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
api, backend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。