/ Useta njani ii-headers ze-HTTP kwiKarate?
IKarate sisixhobo sovavanyo se-API esibanzi kwaye kulula ukuyiqonda iDSL.
Kule posi, sibonisa indlela yokuseta ii-headers ezininzi kwintloko yesicelo.
Imizekelo ibandakanya iArhente yoMsebenzisi, uLuhlu loMxholo, uLwamkelo lweKhowudi, uqhagamshelo, njl.
Zininzi iindlela onokuthi usete izihloko zokucela kwiKarate:
Ungasebenzisa header
igama eliphambili amaxesha amaninzi kwisicelo
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
Ungachaza izihloko ezininzi zonke ezinokuguquguquka kwaye uyisebenzise kwi headers
igama eliphambili lokuthumela zonke iintloko zezicelo
* 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
Enye indlela yokuseta izihloko zesicelo kukusebenzisa 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