Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

robotframework-httpctrl

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

robotframework-httpctrl

robotframework-httpctrl is a library for Robot Framework that provides HTTP/HTTPS client and HTTP server services

  • 0.3.1
  • PyPI
  • Socket score

Maintainers
1

HttpCtrl library for Robot Framework

RobotFramework-HttpCtrl is a library for Robot Framework that provides HTTP/HTTPS client and HTTP (IPv4 and IPv6) server services to make REST API testing easy.

License: The 3-Clause BSD License

Documentation: https://annoviko.github.io/robotframework-httpctrl/

Dependencies

Python version: >=3.8

Installation

Installation using pip3 tool:

.. code:: bash

$ pip3 install robotframework-httpctrl

Brief Overview of the Library Content

HttpCtrl contains following general libraries:

  • HttpCtrl.Client - provides API to work with HTTP/HTTPS client [link client documentation_].

  • HttpCtrl.Server - provides API to work with HTTP server [link server documentation_].

  • HttpCtrl.Json - provides API to work Json messages [link json documentation_].

  • HttpCtrl.Logging - provides API to configure the logging system that is used by HttpCtrl library [link logging documentation_].

.. _link client documentation: https://annoviko.github.io/robotframework-httpctrl/client.html .. _link server documentation: https://annoviko.github.io/robotframework-httpctrl/server.html .. _link json documentation: https://annoviko.github.io/robotframework-httpctrl/json.html .. _link logging documentation: https://annoviko.github.io/robotframework-httpctrl/logging.html

Examples

Send GET request to obtain origin IP address and check that is not empty:

.. code:: robotframework

*** Settings ***

Library         HttpCtrl.Client
Library         HttpCtrl.Json

*** Test Cases ***

Get Origin Address
    Initialize Client   www.httpbin.org
    Send HTTP Request   GET   /ip

    ${response status}=   Get Response Status
    ${response body}=     Get Response Body
    ${response body}=     Decode Bytes To String   ${response body}   UTF-8

    ${expected status}=   Convert To Integer   200
    Should Be Equal   ${response status}   ${expected status}

    ${origin}=    Get Json Value From String   ${response body}   origin
    Should Not Be Empty   ${origin}

In this example HTTP client sends POST request to HTTP server. HTTP server receives it and checks incoming request for correctness.

.. code:: robotframework

*** Settings ***

Library         String
Library         HttpCtrl.Client
Library         HttpCtrl.Server

Test Setup       Initialize HTTP Client And Server
Test Teardown    Terminate HTTP Server

*** Test Cases ***

Receive And Reply To POST
    ${request body}=   Set Variable   { "message": "Hello!" }
    Send HTTP Request Async   POST   /post   ${request body}

    Wait For Request
    Reply By   200

    ${method}=   Get Request Method
    ${url}=      Get Request Url
    ${body}=     Get Request Body
    ${body}=     Decode Bytes To String   ${body}   UTF-8

    Should Be Equal   ${method}   POST
    Should Be Equal   ${url}      /post
    Should Be Equal   ${body}     ${request body}

*** Keywords ***

Initialize HTTP Client And Server
    Initialize Client   127.0.0.1   8000
    Start Server        127.0.0.1   8000

Terminate HTTP Server
    Stop Server

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc