1.0.0 • Published 3 years ago

yandex-tank-ammo v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

yandex-tank-ammo

Generate ammo for yandex-tank

Install

npm i yandex-tank-ammo

Usage

GET method

Script:

  const yandexTankAmmo = require('yandex-tank-ammo');

  const list = [
    {
      'host': 'yandex.ru',
      'method': 'GET',
      'httpVersion': '1.1',
      'tag': 'qqq',
      'url': '/',
      'headers': {
        'Authorization': 'Bearer 8f81c7fe-f5a1-4322-80fa-b54a6553bba9',
        'User-Agent': 'xxx (shell 1)'
      },
    },
  ];

  const ammo = yandexTankAmmo(list);

ammo

123 qqq
GET / HTTP/1.1
Host: yandex.ru
Authorization: Bearer 8f81c7fe-f5a1-4322-80fa-b54a6553bba9
User-Agent: xxx (shell 1)

POST method

Script:

  const yandexTankAmmo = require('yandex-tank-ammo');

  const list = [
    {
      'host': 'yandex.ru',
      'method': 'GET',
      'httpVersion': '1.1',
      'tag': 'qqq',
      'url': '/',
      'headers': {
        'Authorization': 'Bearer 8f81c7fe-f5a1-4322-80fa-b54a6553bba9',
        'User-Agent': 'xxx (shell 1)'
      },
    },
  ];

  const ammo = yandexTankAmmo(list);

ammo

170 qqq
POST / HTTP/1.1
Host: yandex.ru
Authorization: Bearer token
Content-Type: application/json; charset=utf-8
Content-Length: 33

{"filters":{},"size":24,"page":1}

Test

npm run test

License

MIT © nlapshin

1.0.0

3 years ago