req.get('content-type')
natural batch operation ,response Of content-type
Should not return to html type :
Correct batch response,Content-Type
The value should be multipart/mixed; boundary=batchresponse_ Followed by a guid
success handler It's the fnSuccess
, Be wrapped in wraHandler
in .
content-type Different response, There are different corresponding handler To deal with it .
httpClient.request If execution error , Will enter the catch
Branch , Error message :
invalid MIME part type
Use a semicolon to multipart/mixed
and boundary
Separate the specific values of .
Each type has a corresponding handler, By the corresponding handler
call read
Method execution response The parsing operation of .
analysis batch Response to the operation :
In case of error , from Chrome Developer tools network Download from the tab batch Respond to local , Compare it with a no error scenario , There is no difference in format :
The problem is batch response Of header Inside Content-Type
Field .
chrome Seen in content-type Not this :
body yes null, So you can't get in 7884
Yes dispatchHandler
function :
multipart/mixed
MIME Messages consist of a mixture of different data types . Every body part
All by one boundary
Delimitation . boundary
The parameter is a text string , Used to distinguish one part of the message body from another . All boundaries are marked with two hyphens hyphens
(--) start . The final boundary is also marked with two hyphens (--) end . Boundaries can be divided by spaces 、 Any character other than a control character or a special character ASCII Character composition .
If we pass batch Request to send a message to the server word file , be HTTP body payload An example of this is :
Content-type: multipart/mixed;
boundary="Boundary_any ascii character except some of the following special characters:
<BR/> ( )< > @ , ; : \ / [ ] ? = "
"
--Boundary_any ASCII character, except some special characters below:
content-Type: text/plain;----
charset=iso-8859-1
Content-transfer-encoding: 7BIT
--Boundary_ASCII characters
Content-type: application/msword;
name="message.doc"
Content-Transfer-Encoding: base64
stay multipart
In the case of message body , One or more different data sets are combined in one body , The value is multipart
Of Content-Type
Field must appear in HTTP request entity In the header field of . The text is grammatically similar to RFC 822 news , But the meaning is different .
more Jerry The original article of , All in :" Wang Zixi ":