Skip to content

Commit 8dd8662

Browse files
author
nasreenkhannam
committed
Fix SBOM endpoint response handling
Signed-off-by: nasreenkhannam <nasreenkhannam180@gmail.com>
1 parent 13ab47f commit 8dd8662

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

scanpipe/api/views.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,23 +136,22 @@ class ProjectViewSet(
136136
mixins.ListModelMixin,
137137
viewsets.GenericViewSet,
138138
):
139-
@action(detail=True, methods=["get"])
139+
from rest_framework.response import Response
140+
from rest_framework import status
141+
142+
@action(detail=True, methods=["get"])
140143
def sbom(self, request, *args, **kwargs):
141-
"""
142-
Return SBOM for a given PURL.
143-
"""
144144
project = self.get_object()
145145
purl = request.query_params.get("purl")
146146

147147
if not purl:
148-
return ErrorResponse("purl is required")
148+
return Response({"error": "purl is required"}, status=status.HTTP_400_BAD_REQUEST)
149149

150-
# TODO: integrate actual SBOM generation logic
151150
return Response({
152151
"project": project.name,
153152
"purl": purl,
154153
"sbom": "CycloneDX SBOM will be generated here"
155-
},status=200)
154+
})
156155
"""
157156
A viewset that provides the ability to list, get, create, and destroy projects.
158157
Multiple actions are available to manage project instances.

0 commit comments

Comments
 (0)