Upload small file require Content-Length header to put method
Hi, I am trying to upload new file to SharePoint using java as follows: graphServiceClient.drives().byDriveId("DRIVE_ID").items().byDriveItemId("ITEM_ID").content().put(fileInputStream); In case I don't add the Content-Length header to the put method it's failed with Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0 at com.microsoft.kiota.http.OkHttpRequestAdapter$1.contentLength(OkHttpRequestAdapter.java:918) at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:48) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at com.microsoft.kiota.http.middleware.HeadersInspectionHandler.intercept(HeadersInspectionHandler.java:70) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at com.microsoft.kiota.http.middleware.UserAgentHandler.intercept(UserAgentHandler.java:84) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at com.microsoft.kiota.http.middleware.ParametersNameDecodingHandler.intercept(ParametersNameDecodingHandler.java:79) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at com.microsoft.kiota.http.middleware.RetryHandler.intercept(RetryHandler.java:226) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at com.microsoft.kiota.http.middleware.RedirectHandler.intercept(RedirectHandler.java:158) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at com.microsoft.graph.core.requests.middleware.GraphTelemetryHandler.intercept(GraphTelemetryHandler.java:64) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at com.microsoft.kiota.http.middleware.UrlReplaceHandler.intercept(UrlReplaceHandler.java:72) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201) at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154) at com.microsoft.kiota.http.OkHttpRequestAdapter.getHttpResponseMessage(OkHttpRequestAdapter.java:717) at com.microsoft.kiota.http.OkHttpRequestAdapter.send(OkHttpRequestAdapter.java:276) at com.microsoft.graph.drives.item.items.item.content.ContentRequestBuilder.put(ContentRequestBuilder.java:85) at com.bmc.cm.aft.utils.SPOUtilsTest.main(SPOUtilsTest.java:100)
Thanks, Itya