public function iSendARequestWithValues($method, $url, TableNode $post)
    {
        $url = $this->prepareUrl($url);
        $fields = array();

        foreach ($post->getRowsHash() as $key => $val) {
            $fields[$key] = $this->replacePlaceHolder($val);
        }

        $bodyOption = array(
          'body' => json_encode($fields),
        );

        if (version_compare(ClientInterface::VERSION, '6.0', '>=')) {
            $this->request = new Request($method, $url, $this->headers, $bodyOption['body']);
        } else {
            $this->request = $this->getClient()->createRequest($method, $url, $bodyOption);
            if (!empty($this->headers)) {
                $this->request->addHeaders($this->headers);
            }
        }

        $this->sendRequest();
    }
public function iSendARequestWithValues($method, $url, TableNode $post)
    {
        $url = $this->prepareUrl($url);
        $fields = array();

        foreach ($post->getRowsHash() as $key => $val) {
            $fields[$key] = $this->replacePlaceHolder($val);
        }

        $bodyOption = array(
          'body' => json_encode($fields),
        );

        if (version_compare(ClientInterface::VERSION, '6.0', '>=')) {
            $this->request = new Request($method, $url, $this->headers, $bodyOption['body']);
        } else {
            $this->request = $this->getClient()->createRequest($method, $url, $bodyOption);
            if (!empty($this->headers)) {
                $this->request->addHeaders($this->headers);
            }
        }

        $this->sendRequest();
    }
public function iSendARequestWithValues ( $ method , $ url , TableNode $ post ) { $ url = $ this -> prepareUrl ( $ url ) ; $ fields = array ( ) ; foreach ( $ post -> getRowsHash ( ) as $ key => $ val ) { $ fields [ $ key ] = $ this -> replacePlaceHolder ( $ val ) ; } $ bodyOption = array ( 'body' => json_encode ( $ fields ) , ) ; if ( version_compare ( ClientInterface :: VERSION , '6.0' , '>=' ) ) { $ this -> request = new Request ( $ method , $ url , $ this -> headers , $ bodyOption [ 'body' ] ) ; } else { $ this -> request = $ this -> getClient ( ) -> createRequest ( $ method , $ url , $ bodyOption ) ; if ( ! empty ( $ this -> headers ) ) { $ this -> request -> addHeaders ( $ this -> headers ) ; } } $ this -> sendRequest ( ) ; }
Sends HTTP request to specific URL with field values from Table.

@param string    $method request method
@param string    $url    relative url
@param TableNode $post   table of post values

@When /^(?:I )?send a ([A-Z]+) request to "([^"]+)" with values:$/
Sends HTTP request to specific URL with field values from Table .