views: fix support JSON in show_index by duplicating the index under /branch
When loading the show_index, one cannot get the JSON version of the show_index as the server replies with "Supported entities are: text/html". The proposed merge request would duplicate the response for "/" to the page at "/branch".
The show_index fails on "/",
$ curl -sH "Accept: application/json" https://security.alpinelinux.org
<!doctype html>
<html lang=en>
<title>406 Not Acceptable</title>
<h1>Not Acceptable</h1>
<p>The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request. Supported entities are: text/html</p>
, while other endpoints under branch work just fine,
$ curl -sH "Accept: application/json" https://security.alpinelinux.org/branch/edge-main | jq . | head
{
"@context": "https://security.alpinelinux.org/static/context.jsonld",
"id": "https://security.alpinelinux.org/branch/edge-main",
"items": [
{
"@context": "https://security.alpinelinux.org/static/context.jsonld",
"cpeMatch": [
{
"@context": "https://security.alpinelinux.org/static/context.jsonld",
"cpeUri": "cpe:2.3:a:tar_project:tar:*:*:*:*:*:node.js:*:*",
. The acceptance criteria for this change would be the URL /branch would respond with a JSON,
$ curl -sH "Accept: application/json" https://security.alpinelinux.org/branch | jq . | head
[
{
"potentiallyVulnerablePackages": "https://security.alpinelinux.org/branch/edge-main",
"potentiallyOrphanedVulnerablePackages": "https://security.alpinelinux.org/branch/edge-main/vuln-orphaned",
"orphanedPackages": "https://security.alpinelinux.org/branch/edge-main/orphaned",
"issuesByMaintainer": "https://security.alpinelinux.org/branch/edge-main/maintainer-issues",
},
{
"potentiallyVulnerablePackages": "https://security.alpinelinux.org/branch/edge-community",
"potentiallyOrphanedVulnerablePackages": "https://security.alpinelinux.org/branch/edge-community/vuln-orphaned",
.
Thanks!
Edited by schou