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

@seagull/commands-http

Package Overview
Dependencies
Maintainers
4
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@seagull/commands-http

Http commands for the seagull framework

  • 2.10.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-50%
Maintainers
4
Weekly downloads
 
Created
Source

command-http

Command for http requests, implements seed data generation for test cases.

The command can be used like this:

import { Http, RequestConfig } from '../src'
...
const config: RequestConfig = { url }
const response = await new Http.Request<any>(config).execute()

Mode behavior

  • cloud : returns response of the external resource (as defined via url/config)
  • connected : same as cloud
  • edge : same as cloud
  • pure : returns local seed data (throws an error if no seed data is available)

Seed data generation

Use global switch to enable seed data generation while http request:

Http.fetchPureSeed = true
...
// do your thing
...
Http.fetchPureSeed = false

The seed data can be fetched in any mode except pure, as tests within the code pipeline should not call external ressources.

Configuration hooks

In case you want to modify the seed creation for a specific case, you can create a specific SeedLocalConfig by creating a TypeScript-file within the seed folder structure:

import { SeedLocalConfig } from '@seagull/commands-http/seedLocalConfig'

export default <SeedLocalConfig<SomeResponse>>{
  hook: (fixture: SomeResponse) => {
    // do something, e.g. slice some arrays within the fixture
    return fixture
  },
  expiresInDays: 14, // fixture will be re-fetched after 14 days
}

A configuration file is applied for all subsequent fixtures.

Keywords

FAQs

Package last updated on 08 Mar 2019

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