Closed
Description
Any explicit ?format=json
parameter is not passed along in the redirects from the permalink controller, meaning that traditional content negotiation takes over. And so it's not possible to "force" JSON download:
λ curl -L -v http://view.commonwl.org:8082/git/933bf2a1a1cce32d88f88f136275535da9df0954/workflows/hello/hello.cwl?format=json -o a
* STATE: INIT => CONNECT handle 0x20081e60; line 1407 (connection #-5000)
* Added connection 0. The cache now contains 1 members
* Trying 130.88.193.100...
> GET /git/933bf2a1a1cce32d88f88f136275535da9df0954/workflows/hello/hello.cwl?format=json HTTP/1.1
> Host: view.commonwl.org:8082
> User-Agent: curl/7.51.0
> Accept: */*
>
< HTTP/1.1 302
< Location: /workflows/github.com/common-workflow-language/workflows/blob/933bf2a1a1cce32d88f88f136275535da9df0954/workflows/hello/hello.cwl%23main
< Content-Length: 0
< Date: Fri, 25 Aug 2017 10:30:37 GMT
<
But then ?format=json
is not passed along, and so content negotiation (with curl saying Accept: */*
) will pick HTML in the next step:
> GET /workflows/github.com/common-workflow-language/workflows/blob/933bf2a1a1cce32d88f88f136275535da9df0954/workflows/hello/hello.cwl%23main HTTP/1.1
> Host: view.commonwl.org:8082
> User-Agent: curl/7.51.0
> Accept: */*
>
< HTTP/1.1 200
< Content-Type: text/html;charset=UTF-8
< Content-Language: en-US
< Transfer-Encoding: chunked
< Date: Fri, 25 Aug 2017 10:30:37 GMT
Equivalent if a client prefers JSON in its Accept header, then ?format=html
will always give JSON:
curl -H "Accept: application/json" -L http://view.commonwl.org:8082/git/933bf2a1a1cce32d88f88f136275535da9df0954/workflows/hello/hello.cwl?format=html
{"retrievedFrom":{"repoUrl":"https://github.com/common-workflow-language/workflows.git","branch":"933bf2a1a1cce32d88f88f136275535da9df0954","path":"workflows/hello/hello.cwl","packedId":"main","url":"https://github.com/common-workflow-language/workflows/blob/933bf2a1a1cce32d88f88f136275535da9df0954/workflows/hello/hello.cwl#main","rawUrl":"https://github.com/raw/common-workflow-language/workflows/933bf2a1a1cce32d88f88f136275535da9df0954/workflows/hello/hello.cwl","type":"GITHUB"},"retrievedOn":1503656251047,"lastCommit":"933bf2a1a1cce32d88f88f136275535da9df0954","label":"Hello World","doc":"Puts a message into a file using echo","inputs":{},"outputs":{"output":{"type":"File"}},"steps":{"step0":{"run":"hello.cwl#echocmd","runType":"COMMANDLINETOOL"}},"cwltoolVersion":"1.0.20170822192924","visualisationDot":"digraph workflow {\n graph [\n bgcolor = \"#eeeeee\"\n color = \"black\"\n fontsize = \"10\"\n labeljust = \"left\"\n clusterrank = \"local\"\n ranksep = \"0.22\"\n nodesep = \"0.05\"\n ]\n node [\n fontname = \"Helvetica\"\n fontsize = \"10\"\n fontcolor = \"black\"\n shape = \"record\"\n height = \"0\"\n width = \"0\"\n color = \"black\"\n fillcolor = \"lightgoldenrodyellow\"\n style = \"filled\"\n ];\n edge [\n fontname=\"Helvetica\"\n fontsize=\"8\"\n fontcolor=\"black\"\n color=\"black\"\n arrowsize=\"0.7\"\n ];\n subgraph cluster_inputs {\n rank = \"same\";\n style = \"dashed\";\n label = \"Workflow Inputs\";\n }\n subgraph cluster_outputs {\n rank = \"same\";\n style = \"dashed\";\n labelloc = \"b\";\n label = \"Workflow Outputs\";\n \"output\" [fillcolor=\"#94DDF4\",label=\"output\"];\n }\n \"step0\" [label=\"step0\"];\n \"step0\" -> \"output\";\n}\n","visualisationXdot":"/graph/xdot/github.com/common-workflow-language/workflows/blob/933bf2a1a1cce32d88f88f136275535da9df0954/workflows/hello/hello.cwl%23main","visualisationPng":"/graph/png/github.com/common-workflow-language/workflows/blob/933bf2a1a1cce32d88f88f136275535da9df0954/workflows/hello/hello.cwl%23main","visualisationSvg":"/graph/svg/github.com/common-workflow-language/workflows/blob/933bf2a1a1cce32d88f88f136275535da9df0954/workflows/hello/hello.cwl%23main","roBundle":"/robundle/github.com/common-workflow-language/workflows/blob/933bf2a1a1cce32d88f88f136275535da9df0954/workflows/hello/hello.cwl%23main","permalink":"https://w3id.org/cwl/view/git/933bf2a1a1cce32d88f88f136275535da9df0954/workflows/hello/hello.cwl#main"}
Metadata
Metadata
Assignees
Labels
No labels