Skip to content

Commit

Permalink
Fix response encoding for access token request (#18)
Browse files Browse the repository at this point in the history
- response was encoded into JSON twice
- result: it encoded the bytestring from the first encoding
  and encoded it as base64 JSON string
  • Loading branch information
GKnirps authored Jul 9, 2023
1 parent 98af921 commit 3e1ce4d
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions internal/sbi/accesstoken/api_access_token_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (

"github.com/free5gc/nrf/internal/logger"
"github.com/free5gc/nrf/internal/sbi/producer"
"github.com/free5gc/openapi"
"github.com/free5gc/openapi/models"
"github.com/free5gc/util/httpwrapper"
)
Expand Down Expand Up @@ -85,17 +84,5 @@ func HTTPAccessTokenRequest(c *gin.Context) {

httpResponse := producer.HandleAccessTokenRequest(req)

responseBody, err := openapi.Serialize(httpResponse.Body, "application/json")

if err != nil {
logger.AccTokenLog.Warnln(err)
problemDetails := models.ProblemDetails{
Status: http.StatusInternalServerError,
Cause: "SYSTEM_FAILURE",
Detail: err.Error(),
}
c.JSON(http.StatusInternalServerError, problemDetails)
} else {
c.JSON(httpResponse.Status, responseBody)
}
c.JSON(httpResponse.Status, httpResponse.Body)
}

0 comments on commit 3e1ce4d

Please sign in to comment.