Maitiro Ekumisikidza Akawanda Misoro muHTTP Kumbira neKarate

/ Maitiro ekuisa misoro yeHTTP muKarate?

Karate chishandiso chekuyedza cheAPI chine nzwisisika uye iri nyore kunzwisisa DSL.

Mune ino posvo, isu tinoratidza maitiro ekumisikidza akawanda misoro mune yemusoro chikamu chechikumbiro.

Mienzaniso inosanganisira Mushandisi-Mumiriri, Zvemukati-Rudzi, Gamuchira-Encoding, Kubatanidza, nezvimwe.

Pane nzira dzinoverengeka dzaunogona kuseta misoro yekukumbira muKarate:

Uchishandisa musoro

Unogona kushandisa header kiyi kiyi kakawanda muchikumbiro

Given header Content-Type = 'text/xml;charset=ISO-8859-1'
And header Accept-Encoding = 'gzip,deflate'
And header Connection = 'Keep-Alive'
And header Expect = '100-continue'
And header User-Agent = 'Mozilla/4.0(compatible;IE;GACv7. 1. 5192. 22378)'
And header Host = 'localhost'
When url 'http://www.example.com'
And request { some: 'data' }
When method post
Then status 200

Uchishandisa misoro

Iwe unogona zvakare kutsanangura akawanda mahedhiyo ese ari musiyano wobva waishandisa mu headers kiyi yekutumira ese anokumbira misoro

* def req_headers = {Content-Type: 'text/xml;charset=ISO-8859-1', Connection: 'Keep-Alive', User-Agent: 'Mozilla/4.0(compatible;IE;GACv7. 1. 5192. 22378)'} Given headers req_headers
And url 'http://www.example.com'
And request { some: 'data' }
When method post
Then status 200

Uchishandisa kumisikidza misoro

Imwe nzira yekumisikidza misoro yekukumbira ndeye kushandisa configure headers

* configure headers = {Content-Type: 'text/xml;charset=ISO-8859-1', Connection: 'Keep-Alive', User-Agent: 'Mozilla/4.0(compatible;IE;GACv7. 1. 5192. 22378)'} Given url 'http://www.example.com' And request { some: 'data' } When method post Then status 200