@@ -18,6 +18,7 @@ import {
1818 SendRequest ,
1919 RawHttpHeaders
2020} from "@azure/core-https" ;
21+ import { parseXML } from "@azure/core-xml" ;
2122
2223describe ( "deserializationPolicy" , function ( ) {
2324 it ( `should not modify a request that has no request body mapper` , async function ( ) {
@@ -68,21 +69,20 @@ describe("deserializationPolicy", function() {
6869 assert . isUndefined ( response . parsedHeaders ) ;
6970 } ) ;
7071
71- it . skip ( `with xml response body, application/xml content-type, but no operation spec` , async function ( ) {
72+ it ( `with xml response body, application/xml content-type, but no operation spec` , async function ( ) {
7273 const response = await getDeserializedResponse ( {
7374 headers : { "content-type" : "application/xml" } ,
7475 bodyAsText : `<fruit><apples>3</apples></fruit>`
7576 } ) ;
7677 assert . exists ( response ) ;
7778 assert . isUndefined ( response . readableStreamBody ) ;
7879 assert . isUndefined ( response . blobBody ) ;
79- assert . isUndefined ( response . parsedBody ) ;
8080 assert . isUndefined ( response . parsedHeaders ) ;
8181 assert . strictEqual ( response . bodyAsText , `<fruit><apples>3</apples></fruit>` ) ;
8282 assert . deepEqual ( response . parsedBody , { apples : "3" } ) ;
8383 } ) ;
8484
85- it . skip ( `with xml response body with child element with attributes and value, application/xml content-type, but no operation spec` , async function ( ) {
85+ it ( `with xml response body with child element with attributes and value, application/xml content-type, but no operation spec` , async function ( ) {
8686 const response = await getDeserializedResponse ( {
8787 headers : { "content-type" : "application/xml" } ,
8888 bodyAsText : `<fruit><apples tasty="yes">3</apples></fruit>`
@@ -103,7 +103,7 @@ describe("deserializationPolicy", function() {
103103 assert . isUndefined ( response . parsedHeaders ) ;
104104 } ) ;
105105
106- it . skip ( `with xml response body, application/xml content-type, and operation spec for only String value` , async function ( ) {
106+ it ( `with xml response body, application/xml content-type, and operation spec for only String value` , async function ( ) {
107107 const operationSpec : OperationSpec = {
108108 httpMethod : "GET" ,
109109 serializer : createSerializer ( { } , true ) ,
@@ -144,7 +144,7 @@ describe("deserializationPolicy", function() {
144144 assert . isUndefined ( response . parsedHeaders ) ;
145145 } ) ;
146146
147- it . skip ( `with xml response body, application/xml content-type, and operation spec for only number value` , async function ( ) {
147+ it ( `with xml response body, application/xml content-type, and operation spec for only number value` , async function ( ) {
148148 const operationSpec : OperationSpec = {
149149 httpMethod : "GET" ,
150150 serializer : createSerializer ( { } , true ) ,
@@ -180,11 +180,11 @@ describe("deserializationPolicy", function() {
180180 assert . isUndefined ( response . readableStreamBody ) ;
181181 assert . isUndefined ( response . blobBody ) ;
182182 assert . strictEqual ( response . bodyAsText , `<fruit><apples tasty="yes">3</apples></fruit>` ) ;
183- assert . deepEqual ( response . parsedBody , { apples : "3" } ) ;
183+ assert . deepEqual ( response . parsedBody , { apples : 3 } ) ;
184184 assert . isUndefined ( response . parsedHeaders ) ;
185185 } ) ;
186186
187- it . skip ( `with xml response body, application/xml content-type, and operation spec for only headers` , async function ( ) {
187+ it ( `with xml response body, application/xml content-type, and operation spec for only headers` , async function ( ) {
188188 const operationSpec : OperationSpec = {
189189 httpMethod : "GET" ,
190190 serializer : createSerializer ( { } , true ) ,
@@ -235,7 +235,7 @@ describe("deserializationPolicy", function() {
235235 assert . deepEqual ( response . parsedBody , { apples : { tasty : "yes" } } ) ;
236236 } ) ;
237237
238- it . skip ( `with xml response body, application/atom+xml content-type, but no operation spec` , async function ( ) {
238+ it ( `with xml response body, application/atom+xml content-type, but no operation spec` , async function ( ) {
239239 const response = await getDeserializedResponse ( {
240240 headers : { "content-type" : "application/xml" } ,
241241 bodyAsText : `<fruit><apples>3</apples></fruit>`
@@ -249,7 +249,7 @@ describe("deserializationPolicy", function() {
249249 assert . deepEqual ( response . parsedBody , { apples : "3" } ) ;
250250 } ) ;
251251
252- it . skip ( `with xml property with attribute and value, application/atom+xml content-type, but no operation spec` , async function ( ) {
252+ it ( `with xml property with attribute and value, application/atom+xml content-type, but no operation spec` , async function ( ) {
253253 const response = await getDeserializedResponse ( {
254254 headers : { "content-type" : "application/atom+xml" } ,
255255 bodyAsText : `<fruit><apples taste="good">3</apples></fruit>`
@@ -270,7 +270,7 @@ describe("deserializationPolicy", function() {
270270 } ) ;
271271 } ) ;
272272
273- it . skip ( `with xml property with attribute and value, my/weird-xml content-type, but no operation spec` , async function ( ) {
273+ it ( `with xml property with attribute and value, my/weird-xml content-type, but no operation spec` , async function ( ) {
274274 const response = await getDeserializedResponse ( {
275275 headers : { "content-type" : "my/weird-xml" } ,
276276 bodyAsText : `<fruit><apples taste="good">3</apples></fruit>` ,
@@ -292,7 +292,7 @@ describe("deserializationPolicy", function() {
292292 } ) ;
293293 } ) ;
294294
295- it . skip ( `with service bus response body, application/atom+xml content-type, and no operationSpec` , async function ( ) {
295+ it ( `with service bus response body, application/atom+xml content-type, and no operationSpec` , async function ( ) {
296296 const response = await getDeserializedResponse ( {
297297 headers : { "content-type" : "application/atom+xml;type=entry;charset=utf-8" } ,
298298 bodyAsText : `<entry xmlns="http://www.w3.org/2005/Atom"><id>https://daschulttest1.servicebus.windows.net/testQueuePath/?api-version=2017-04&enrich=False</id><title type="text">testQueuePath</title><published>2018-10-09T19:56:34Z</published><updated>2018-10-09T19:56:35Z</updated><author><name>daschulttest1</name></author><link rel="self" href="https://daschulttest1.servicebus.windows.net/testQueuePath/?api-version=2017-04&enrich=False"/><content type="application/xml"><QueueDescription xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><LockDuration>PT1M</LockDuration><MaxSizeInMegabytes>1024</MaxSizeInMegabytes><RequiresDuplicateDetection>false</RequiresDuplicateDetection><RequiresSession>false</RequiresSession><DefaultMessageTimeToLive>P14D</DefaultMessageTimeToLive><DeadLetteringOnMessageExpiration>false</DeadLetteringOnMessageExpiration><DuplicateDetectionHistoryTimeWindow>PT10M</DuplicateDetectionHistoryTimeWindow><MaxDeliveryCount>10</MaxDeliveryCount><EnableBatchedOperations>true</EnableBatchedOperations><SizeInBytes>0</SizeInBytes><MessageCount>0</MessageCount><IsAnonymousAccessible>false</IsAnonymousAccessible><AuthorizationRules></AuthorizationRules><Status>Active</Status><CreatedAt>2018-10-09T19:56:34.903Z</CreatedAt><UpdatedAt>2018-10-09T19:56:35.013Z</UpdatedAt><AccessedAt>0001-01-01T00:00:00Z</AccessedAt><SupportOrdering>true</SupportOrdering><CountDetails xmlns:d2p1="http://schemas.microsoft.com/netservices/2011/06/servicebus"><d2p1:ActiveMessageCount>0</d2p1:ActiveMessageCount><d2p1:DeadLetterMessageCount>0</d2p1:DeadLetterMessageCount><d2p1:ScheduledMessageCount>0</d2p1:ScheduledMessageCount><d2p1:TransferMessageCount>0</d2p1:TransferMessageCount><d2p1:TransferDeadLetterMessageCount>0</d2p1:TransferDeadLetterMessageCount></CountDetails><AutoDeleteOnIdle>P10675199DT2H48M5.4775807S</AutoDeleteOnIdle><EnablePartitioning>false</EnablePartitioning><EntityAvailabilityStatus>Available</EntityAvailabilityStatus><EnableExpress>false</EnableExpress></QueueDescription></content></entry>`
@@ -444,7 +444,10 @@ async function getDeserializedResponse(
444444 xmlContentTypes ?: string [ ] ;
445445 } = { }
446446) : Promise < FullOperationResponse > {
447- const policy = deserializationPolicy ( { expectedContentTypes : { xml : options . xmlContentTypes } } ) ;
447+ const policy = deserializationPolicy ( {
448+ expectedContentTypes : { xml : options . xmlContentTypes } ,
449+ parseXML
450+ } ) ;
448451 const request : OperationRequest = createPipelineRequest ( { url : "https://example.com" } ) ;
449452 request . additionalInfo = {
450453 operationSpec : options . operationSpec
0 commit comments