contexts icon indicating copy to clipboard operation
contexts copied to clipboard

Bug on RestContext

Open titomiguelcosta opened this issue 12 years ago • 6 comments

On the RestContext, we need to add quotes on the following to steps around the method name:

  • @Given /^I send a (?P[A-Z]+) request on "(?P[^"]*)"$/
  • @Given /^I send a (?P[A-Z]+) request on "(?P[^"]*)" with parameters:$/

If we do not do it, behat does not catch it is a parameter. Correct me if I am wrong.

It would be nice to have a step to assert the reason phrase, like we have for status code. When I get 200 response, I would like also to check the reason phrase is "OK".

titomiguelcosta avatar Sep 18 '13 13:09 titomiguelcosta

On the RestContext, we need to add quotes on the following to steps around the method name

No, behat catches parameters with parenthesis.

It would be nice to have a step to assert the reason phrase, like we have for status code. When I get 200 response, I would like also to check the reason phrase is "OK".

You can use Then the header "Reason-Phrase" should be equal to "OK".

sanpii avatar Sep 18 '13 14:09 sanpii

You are absolutely right about the parenthesis. It works fine.

About the reason phrase, I should be doing something wrong. I get the message there is no reason-phrase header. If I print last response headers, it is not there. IMHO it should not be a header, reason phrase is part of the first line of the response, like the status code, not really a header. I get the following headers:

| date: Wed, 18 Sep 2013 14:33:25 GMT | server: Apache | x-powered-by: PHP/5.3.10-1ubuntu3.8 | set-cookie: PHPSESSID=cpio70b687k9bjisgvq46c9tt2; path=/ | cache-control: no-cache | x-debug-token: 38c19a | vary: Accept-Encoding | transfer-encoding: chunked | content-type: application/json

titomiguelcosta avatar Sep 18 '13 14:09 titomiguelcosta

Ok, the reason phrase is a part of the status header: Status Code and Reason Phrase.

It should be great to have a definition for test it.

sanpii avatar Sep 19 '13 09:09 sanpii

Waiting for MinkExtension #113.

sanpii avatar Nov 07 '13 13:11 sanpii

The blocker, https://github.com/Behat/MinkExtension/issues/113, has been closed one year ago.

dinamic avatar Jul 10 '15 16:07 dinamic

ping

razbakov avatar Aug 24 '17 12:08 razbakov