-
Notifications
You must be signed in to change notification settings - Fork 144
Closed
Labels
status:waiting-for-triageAn issue that is yet to be reviewed or assignedAn issue that is yet to be reviewed or assigned
Description
Hello, I do apologize if there is a more appropriate place for this "issue", but the discussion page gives a 404.
I have been trying to get the response headers from a empty body response specifically the copy drive item endpoint: POST /drives/{driveId}/items/{itemId}/copy.
This code I have in which I attempt to retrieve response headers:
final CopyPostRequestBody copyPostRequestBody = new CopyPostRequestBody();
copyPostRequestBody.setParentReference(existingFile.getParentReference());
copyPostRequestBody.setName("foo bar" + "." + FilenameUtils.getExtension(existingFile.getName()));
// copy file from drive /drives/{driveId}/items/{itemId}/copy
final HashMap<String, Object> pathParams = new HashMap<>();
pathParams.put("baseUrl", graphServiceClient.getRequestAdapter().getBaseUrl());
pathParams.put("driveId", existingFile.getParentReference().getDriveId());
pathParams.put("itemId", existingFile.getId());
RequestInformation requestInformation = new RequestInformation();
requestInformation.httpMethod = HttpMethod.POST;
requestInformation.urlTemplate = "{+baseUrl}/drives/{driveId}/items/{itemId}/copy";
requestInformation.pathParameters = pathParams;
requestInformation.setContentFromParsable(graphServiceClient.getRequestAdapter(), "application/json", copyPostRequestBody);
HashMap<String, ParsableFactory<? extends Parsable>> errorMapping = new HashMap<>();
// I don't think this will ever work
final Response response = graphServiceClient.getRequestAdapter().sendPrimitive(requestInformation, errorMapping, Response.class);I know "sendPrimitive" is incorrect, because it will try to parse the body which is null. My question is how do I correctly get the headers from this response. I think it revolves around setting a responseHandler on the requestInformation. How to actually do that is unclear to me.
Any help would be appreciated, thank you.
Metadata
Metadata
Assignees
Labels
status:waiting-for-triageAn issue that is yet to be reviewed or assignedAn issue that is yet to be reviewed or assigned