Skip to content

Logging of http requests/responses #638

Description

@jgoldhammer

Description of the Issue

Digging deeper into the box-java-sdk brings up the issue that sometimes a request does not work. If you hit a 4xx response error, it would be great to find out how the request was builded and how it looks like.

Versions Used

Java SDK: 2.23.0
Java: 1.8

Steps to Reproduce

Try to reproduce with a http request to box with a wrong user id or something, so that a 404 error or something else

Error Message, Including Stack Trace

Example error message when creating an appuser with role coadmin:

com.box.sdk.BoxAPIResponseException: The API returned an error code [400 | daa422fuq0lmxayt] invalid_request_parameters - Invalid input parameters in request

	at com.box.sdk.BoxAPIResponse.<init>(BoxAPIResponse.java:92)
	at com.box.sdk.BoxJSONResponse.<init>(BoxJSONResponse.java:32)
	at com.box.sdk.BoxAPIRequest.trySend(BoxAPIRequest.java:551)
	at com.box.sdk.BoxAPIRequest.send(BoxAPIRequest.java:326)
	at com.box.sdk.BoxAPIRequest.send(BoxAPIRequest.java:301)
	at com.box.sdk.BoxUser.createEnterpriseUser(BoxUser.java:148)
	at com.box.sdk.BoxUser.createAppUser(BoxUser.java:93)
	at de.fme.box.BoxJavaSDKTests.appUserTest(BoxJavaSDKTests.java:57)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementAdded to issues that describes enhancements

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions