Skip to content

Commit 1556a38

Browse files
committed
handle sendEmail content type
1 parent a93b72a commit 1556a38

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/DeserializeInterceptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public void execute(IntuitMessage intuitMessage) throws FMSException {
7979
} else {
8080
response = serializer.deserialize(responseElements.getDecompressedData(), IntuitResponse.class);
8181
}
82-
} else if (serializeFormat.equalsIgnoreCase(ContentTypes.PDF.name()) || serializeFormat.equalsIgnoreCase("plain")) {
82+
} else if (serializeFormat.equalsIgnoreCase(ContentTypes.PDF.name()) || serializeFormat.equalsIgnoreCase("plain") || serializeFormat.equalsIgnoreCase("octet-stream")) {
8383
LOG.info("PDF or plain content has been received");
8484
// do nothing, since we will use binary of the response as is
8585

ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/PrepareRequestInterceptor.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ private void prepareDataServiceRequest(IntuitMessage intuitMessage, RequestEleme
103103
// add content type, except POST queries with email ("<entity>/id/send?...") - it has no POST body
104104
if (StringUtils.hasText(serializeFormat) && !isSendEmail(requestParameters)) {
105105
requestHeaders.put(RequestElements.HEADER_PARAM_CONTENT_TYPE, ContentTypes.getContentType(serializeFormat));
106+
}
107+
else if (StringUtils.hasText(serializeFormat) && isSendEmail(requestParameters)) {
108+
requestHeaders.put(RequestElements.HEADER_PARAM_CONTENT_TYPE, ContentTypes.OCTECT_STREAM.toString());
106109
}
107110
}
108111

ipp-v3-java-devkit/src/main/java/com/intuit/ipp/net/ContentTypes.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ public enum ContentTypes {
4747
* content type MULTIPART_FORMDATA
4848
*/
4949
MULTIPART_FORMDATA("multipart/form-data"),
50+
51+
OCTECT_STREAM("application/octet-stream"),
5052

5153

5254
/**

ipp-v3-java-devkit/src/test/java/com/intuit/ipp/net/ContentTypesTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void testGetContentType_others() {
3535
@Test
3636
public void testGetContentType_values() {
3737
ContentTypes[] contentTypes = ContentTypes.values();
38-
Assert.assertEquals(contentTypes.length, 6);
38+
Assert.assertEquals(contentTypes.length, 7);
3939
}
4040

4141
@Test

0 commit comments

Comments
 (0)