vlucas / frisby

Frisby is a REST API testing framework built on Jest that makes testing API endpoints easy, fast, and fun.

Home Page:http://frisbyjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is there a function similar to bodyContains but for headers?

Cenric opened this issue · comments

I am trying to expect a value in the header to contain certain text, something like

.expect('header', 'key', startsWith('value'))

but nothing seems to work. I see that there is a built in bodyContains function, was wondering how I could do this for running an expect on a header key/value as well?

value parameter is regular expression.

.expect('header', 'key', /^value/))

I think this test will be helpful.

Thank you so much, this helped a lot!