responsetransform

Hi Stephane,

As suggested by you I have used transformresponse, but seeing error.
Please correct the code, so that i can proceed further, I am stuck from long time here.

Thanks,
Trisha agarwal

Hi Trisha,

What error did you get? I’m sure that is the first question Stephane is going to ask you. Also, he might say (like he has said a couple of times now) get the developers to fix the json response instead of trying to get gatling to work with bad json responses.

-GK

Thanks George for replying.

Developers are not ready to change the response, they are saying its a valid one you can replace and use it.
And regarding my code, I have attached the image above.
Inserting it again.

Thanks,
Trisha

Forgive me if I am missing it but what error are you getting or gatling is throwing?

This payload is NOT valid JSON!!!

Your payload: {“controllerData”:{“MashupRefs”:{“MashupRef”:[{“mashupId”:“isf.shipment-pick.getShipmentDetails”,“Output”:{“Shipment”:{“Status”:{“Status”:“1100.70.06.10”,“Description”:“Ready For Backroom Pick”},“IsOverdue”:“true”,“DeliveryMethod”:“PICK”,“DocumentType”:“0001”,“ImageUrl”:“isf\x2Fresources\x2Fcss\x2Ficons\x2Fimages\x2FtimeOverdue.png”,“OrderNo”:“3100000240”,“Status_scattr”:“1100.70.06.10”,“DisplayOrderNo”:“3100000240”,“ShipmentNo”:“100000140”,“ShipmentKey”:“202108102030071344685”,“SLACssClass”:“time_overdue”,“ExpectedShipmentDate”:“2021-08-10T22\x3A30\x3A08\x2B00\x3A00”,“TimeRemaining”:“Delayed by 3 d”,“SellerOrganizationCode”:“BAY”,“ShipNode”:“1101”,“OrderHeaderKey”:“202108102029241344371”,“EnterpriseCode”:“BAY”,“ImageAltText”:“Overdue”}},“mashupRefId”:""},{“mashupId”:“isf.shipment-pick.getAllPickableShipmentLineList”,“Output”:{“ShipmentLines”:{“TotalQuantity”:“1”,“ShipmentLine”:{“OriginalQuantity”:“1”,“UnitOfMeasure”:“EACH”,“Shipment”:[{“Currency”:“CAD”,“EnterpriseCode”:“BAY”}],“DocumentType”:“0001”,“ImageURL”:"https\x3A\x2F[x2Fs7d9.scene7.com\x2Fis\x2Fimage\x2FTheBay\x2F\x2F0703113596452_main",“Quantity”:“1”,“OrderNo”:“3100000240”,“Extn”:{“ExtnIsInternational”:“N”},“ItemID”:“90407099”,“ShipmentKey”:“202108102030071344685”,“ShipmentTagSerials”:{},“ShipmentLineKey”:“202108102030071344684”,“ShortageQty”:“0”,“ShipmentSubLineNo”:“0”,“OrderLine”:{“ItemDetails”:{“DisplayUnitOfMeasure”:“Each”,“UnitOfMeasure”:“EACH”,“AttributeList”:{“Attribute”:[{“Value”:“BLACK”,“Name”:“Color”},{“Value”:“One Size”,“Name”:“Size”}]},“Extn”:{“ExtnDivision”:“KITCHEN”,“ExtnVendorStyle”:“059645”,“ExtnClass”:“010”,“ExtnJewelryFlag”:“N”,“ExtnDepartment”:“636”,“ExtnDepartmentName”:“HOME”},“UOMDisplayFormat”:“formattedQty”,“ItemID”:“90407099”,“ClassificationCodes”:{“Model”:“0600090407099”},“InventoryParameters”:{“IsSerialTracked”:“N”},“AdditionalAttributeList”:{“AdditionalAttribute”:[{“Value”:“BLACK”,“Name”:“Color”},{“Value”:“One Size”,“Name”:“Size”}]},“ItemGroupCode”:“PROD”,“ItemAliasList”:{“ItemAlias”:[{“AliasValue”:“703113596452”,“AliasName”:“ACTIVE_UPC”}]},“Variation”:“BLACK \x7C One Size”,“PrimaryInformation”:{“Description”:“Dept NameHOME Class desc COUNTERTOP BLENDERS Brand Vitamix VITA-MIX,CORP. 059645 VITAMIX 6500 - BLACK”,“ManufacturerName”:“Vitamix”,“ImageID”:“0703113596452_main”,“ExtendedDisplayDescription”:“6500 Blender \x2890407099\x29”,“ImageLocation”:“https\x3A\x2F[x2Fs7d9.scene7.com](http://x2fs7d9.scene7.com/)\x2Fis\x2Fimage\x2FTheBay\x2F”}},“CarrierServiceCode”:"",“ItemGroupCode”:“PROD”,“IsBundleParent”:“N”},“OrderHeaderKey”:“202108102029241344371”,“ProductClass”:"",“Variation”:“BLACK \x7C One Size”,“ShipmentLineNo”:“1”,“BackroomPickedQuantity”:"",“OrderLineKey”:“202108102029241344372”}],“TotalNumberOfRecords”:“1”}},“mashupRefId”:""}]}}}

Try validating it in https://jsonlint.com/ and see for yourself.

Your usage of transformResponse is incorrect, you’ve probably copy pasted from an outdated source.
See https://github.com/gatling/gatling-private/blob/main/gatling-http/src/test/scala/io/gatling/http/compile/HttpCompileTest.scala#L337-L340

Stéphane, your link returns a 404 for me.

Do you mean https://jsonlint.com/ ?
It works for me.

You can also use https://jsonformatter.curiousconcept.com/, just make sure to uncheck “Fix JSON” on the right side.

No I mean the gatling github link: https://github.com/gatling/gatling-private/blob/main/gatling-http/src/test/scala/io/gatling/http/compile/HttpCompileTest.scala#L337-L340

I does have “gatling-private” in the URL so maybe that’s part of it?

Right, the correct url is https://github.com/gatling/gatling/blob/main/gatling-http/src/test/scala/io/gatling/http/compile/HttpCompileTest.scala#L337-L340