New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dummy_oscar

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dummy_oscar

  • 0.1.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

DummyOscar

DummyOscar is tool for creating a dummy HTTP server and client.

Server

You can define a path that returns a dummy response by YAML file. You can use ERB inside the file.

Example:

# sample.yaml
paths:
  /:
    get:
      response:
        status_code: 200
        body: "hello,world"
  /users:
    post:
      response:
        status_code: 204
    get:
      response:
        status_code: 200
        body: '<%= File.read('test/fixtures/users.json') %>'
  /users/dummy.json:
    get:
      response:
        status_code: 200
        body: <%= {name: 'dummy'}.to_json %>
        content_type: 'application/json'
  /users/.+/books:
    get:
      response:
        status_code: 200
        body: '[{"title":"Abc"},{"title":"deF"}]'
        content_type: 'application/json'

You can now start the dummy server.

$ dummy_oscar s -C sample.yaml
$ curl http://localhost:8282
hello,world
$ curl http://localhost:8282/users/1/books
[{"title":"Abc"},{"title":"deF"}]

If you want to use custom methods inside the YAML, you can pass a Ruby file that will load during the parsing of the YAML file.

$ dummy_oscar s -C sample.yaml -r ./library_for_config.rb

Client

You can define a path and request body by YAML file. You can use ERB inside the file.

Example:

requests:
  hello:
    path: "/"
    method: "get"
  create_user:
    path: "/users"
    method: "post"
    body: <%= {name: 'dummy'}.to_json %>

You can send request like the following.

$ dummy_oscar c -C sample.yml -h http://localhost:5252 -c hello

FAQs

Package last updated on 04 Apr 2024

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