Overview

Namespaces

  • Docta
    • MercadoLibre
      • Exception
      • OAuth2
        • Client
          • Test
  • GuzzleHttp
    • Cookie
    • Exception
    • Handler
    • Promise
      • Test
      • Tests
    • Psr7
    • Test
      • Handler
    • Tests
      • CookieJar
      • Event
      • Exception
      • Handler
      • Promise
      • Psr7
  • League
    • OAuth2
      • Client
        • Grant
          • Exception
        • Provider
          • Exception
        • Test
          • Grant
          • Provider
            • Exception
            • Fake
          • Token
          • Tool
        • Token
        • Tool
  • None
  • Psr
    • Http
      • Message

Classes

  • ClientTest
  • HandlerStackTest
  • MessageFormatterTest
  • MiddlewareTest
  • MultipartStreamTest
  • PoolTest
  • PrepareBodyMiddlewareTest
  • RedirectMiddlewareTest
  • RetryMiddlewareTest
  • Server
  • TransferStatsTest
  • UriTemplateTest
  • Overview
  • Namespace
  • Class
  • Download

Class Server

The Server class is used to control a scripted webserver using node.js that will respond to HTTP requests with queued responses.

Queued responses will be served to requests using a FIFO order. All requests received by the server are stored on the node.js server and can be retrieved by calling Server::received().

Mock responses that don't require data to be transmitted over HTTP a great for testing. Mock response, however, cannot test the actual sending of an HTTP request using cURL. This test server allows the simulation of any number of HTTP request response transactions to test the actual sending of requests over the wire without having to leave an internal network.

Namespace: GuzzleHttp\Tests
Located at tests/Server.php
Methods summary
public static
# flush( )

Flush the received requests from the server

Flush the received requests from the server

Throws

RuntimeException
public static
# enqueue( array|Psr\Http\Message\ResponseInterface $responses )

Queue an array of responses or a single response on the server.

Queue an array of responses or a single response on the server.

Any currently queued responses will be overwritten. Subsequent requests on the server will return queued responses in FIFO order.

Parameters

$responses

A single or array of Responses to queue.

Throws

Exception
public static Psr\Http\Message\ResponseInterface[]
# received( )

Get all of the received requests

Get all of the received requests

Returns

Psr\Http\Message\ResponseInterface[]

Throws

RuntimeException
public static
# stop( )

Stop running the node.js server

Stop running the node.js server

public static
# wait( $maxTries = 5 )
public static
# start( )
Properties summary
public static string $url
# 'http://127.0.0.1:8126/'
public static integer $port
# 8126
MercadoLibre PHP SDK API documentation generated by ApiGen