httpexpect icon indicating copy to clipboard operation
httpexpect copied to clipboard

Set multiple status as success criteria

Open ihassanyousaf opened this issue 3 years ago • 1 comments

Hi,

Is there anyway to set multiple statuses as success criteria. e-g 200 and 404 as success criteria?

The usecase is like deleting something from API let's just say a project, api will return 2xx in case the project existed and deleted and 404 in case the project didn't exist.

both case are considered as success as the main idea is not to have a project in the system.

Is there anyway of doing this? If not, do you think it might be a good idea of implementing this?

ihassanyousaf avatar Apr 09 '22 00:04 ihassanyousaf

I'd be happy to work on this if help is desired

ahdekkers avatar May 14 '22 16:05 ahdekkers

Hi, sure, this is a valid feature, pull requests are welcome.

We already have methods Status and StatusRange, we could add a new method StatusList that accepts a list of statuses as variadic argument.

gavv avatar Nov 13 '22 08:11 gavv

Hi @gavv @ahdekkers I'll be happy to help if this issue still open

edwinwijaya94 avatar Dec 08 '22 15:12 edwinwijaya94

@edwinwijaya94 Great, you're welcome, thank you.

gavv avatar Dec 08 '22 16:12 gavv

@ihassanyousaf this feature is merged to master now

gavv avatar Dec 13 '22 15:12 gavv