You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Request logging silently discarded for non-JSON/form-encoded entity types #1322
When calling MergeRequestApi.acceptMergeRequest(projectId, mrIid), the HTTP request line and headers are not logged, even though the response is logged normally.
Root cause
In MaskingLoggingFilter.aroundWriteTo(), there's a conditional check that only logs when the media type is application/json or application/x-www-form-urlencoded:
For text/plain the request line and headers accumulated in the StringBuilder are discarded.
Expected Log (should show PUT request)
11:57:55,027 INFO [train-processor-1] 1 - Sending client request on thread train-processor-1
1 > PUT http://localhost:8929/api/v4/projects/1/merge_requests/2/merge
1 > Accept: application/json
1 > Content-Type: text/plain
1 > PRIVATE-TOKEN: ********
11:57:55,188 INFO [train-processor-1] 1 - Received server response on thread train-processor-1
1 < 422
1 < Cache-Control: no-cache
1 < Content-Length: 37
1 < Content-Type: application/json
...
Current Behavior (request missing)
Only the response is logged; the request line and headers are lost.
Question
Why does the if condition in aroundWriteTo() restrict logging only to JSON and form-urlencoded? Without this check, the request logs appear correctly. I've already run some tests without that if statement and everything seems okay.
I am wondering why MergeRequestApi.acceptMergeRequest(projectId, mrIid) is sending a text/plain request. Does it makes sense?
From my observation the GitLab server supports many ways to express request parameters. You can pass parameters as string query parameter or as Json request body. I have noticed many inconsistency in the GitLab4j client.
We we decide to keep text/plain, probably the mentioned class MaskingLoggingFilter.java should be modified.
It's assumed that if there are no queryParams (entity data) it will always be text/plain. I don't know if this is valid for all endpoints that don't require a payload body.
Activity
jmini commentedon May 12, 2026
I am wondering why
MergeRequestApi.acceptMergeRequest(projectId, mrIid)is sending atext/plainrequest. Does it makes sense?From my observation the GitLab server supports many ways to express request parameters. You can pass parameters as string query parameter or as Json request body. I have noticed many inconsistency in the GitLab4j client.
We we decide to keep
text/plain, probably the mentioned classMaskingLoggingFilter.javashould be modified.It needs more investigations
mhagnumdw commentedon May 12, 2026
It's sending
text/plainbecause of line 750 below.gitlab4j-api/gitlab4j-api/src/main/java/org/gitlab4j/api/GitLabApiClient.java
Lines 748 to 755 in 6478b39
It's assumed that if there are no
queryParams(entity data) it will always betext/plain. I don't know if this is valid for all endpoints that don't require a payload body.Official GitLab documentation about Request payload: https://docs.gitlab.com/18.11/api/rest/#request-payload