Skip to content

fix(event-exposure): return 204 instead of 200 on subscription delete - #234

Open
ALIIQBAL786 wants to merge 1 commit into
free5gc:mainfrom
ALIIQBAL786:fix/event-exposure-delete-status-code
Open

fix(event-exposure): return 204 instead of 200 on subscription delete#234
ALIIQBAL786 wants to merge 1 commit into
free5gc:mainfrom
ALIIQBAL786:fix/event-exposure-delete-status-code

Conversation

@ALIIQBAL786

Copy link
Copy Markdown

Summary

HandleDeleteAMFEventSubscription returns 200 with a null body on a successful delete. Per 3GPP TS 29.518, Namf_EventExposure's Unsubscribe operation should return 204 No Content.

This isn't just a spec nitpick - it actually breaks the standards-compliant generated SBI client in free5gc/openapi's amf/EventExposure package. That client's DeleteSubscription only special-cases 204 as success:

switch localVarHTTPResponse.StatusCode {
case 204:
    return &localVarReturnValue, nil
...

Any other status code (including the 200 this handler returns) falls through to the generic error path, so every consumer using that client sees a successful delete as a failure.

How I found this

While building and testing a NEF feature (Monitoring Event API, free5gc/nef#31) that creates and deletes Namf_EventExposure subscriptions, against a real running AMF instance - not a mock. POST worked; DELETE consistently came back as a NEF-side 500 even though AMF's own access log showed the delete had actually succeeded. Traced it to this status code mismatch.

Fix

c.JSON(http.StatusOK, nil)c.Status(http.StatusNoContent).

Test plan

  • GOOS=linux GOARCH=amd64 go build ./... and go vet ./... pass (native darwin build fails on this machine for unrelated reasons - github.com/free5gc/sctp doesn't support darwin - not something this change touches or is affected by)
  • Verified against a real running AMF: DELETE /namf-evts/v1/subscriptions/{id} now returns 204, and the NEF consumer correctly treats it as success

3GPP TS 29.518 Namf_EventExposure's Unsubscribe operation returns
204 No Content on success. HandleDeleteAMFEventSubscription was
returning 200 with a null JSON body instead, which the standards-
compliant generated SBI client (github.com/free5gc/openapi's
EventExposure package) doesn't recognize as success - it only
special-cases 204, so every caller using that client sees a
successful delete as a failure.

Found while building and testing a NEF feature that consumes this
API against a real running AMF instance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant