I am trying to send a zip file as binary via HTTP request, When I do a call setting the Postman's tab as Binary then it works as I want to:
But when I try to send the same file as binary and use the option "RAW" then it does not work.I've tried to convert the zip into a binary in Java with the below code:
try {
StringBuilder sb = new StringBuilder();
File file = new File(filePath);
DataInputStream input = new DataInputStream( new FileInputStream( file ) );
try {
while( true ) {
sb.append( Integer.toBinaryString( input.readByte() ) );
//10100001001011111001010000010000101111111111111111111111111111111100101101010101100100111111111111111111111111111001110101100111111111111111111111111110110011101000010000001000000111010011001011110011111010010111011101001111000111010010101110010011011011011101001001110101110000110000100010100001001011110111110101000001000010111111111111111111111111111111110010110101010110010011111111111111111111111111100111010110011111111111111111111111111011001110100001000000100001001000000000100000000000011101001100101111001111101001011101110100111100011101001010010000000000101100001011001101100100010111101111011011111111111111111111111111011001110110011011001000101111011110110111111111111111111111111110110011111111111111111111111111101110101111111111111111111111111011011111111111111111111111111111101110100110111101101111111111111111111111111101100111010000100101110111000001010101101000011000000000
}
} catch( EOFException eof ) {
} catch( IOException e ) {
e.printStackTrace();
}
System.out.println(sb.toString());
} catch( FileNotFoundException e2 ) {
e2.printStackTrace();
}
The message is being receiving with a different size and it is not the content I am expecting:
Can you tell me how I can send it as binary using the tab raw?