Skip to content

Releases: evg4b/uncors

v0.3.0

22 Sep 19:53
Compare
Choose a tag to compare

Fake data generator

Added ability to generate JSON based on JSONSchema-like configuration:

Object definition

type: object
seed: <randomizing-seed>
properties:
  <property1-name>: <property1-value>
  <property2-name>: <property2-value>
  <property3-name>: <property3-value>

Where:

  • - The seed for generator to freeze generated value
  • <property1-name>, <property2-name>, etc - The names of the object properties.
  • <property1-value>, <property1-value>, etc - The node definition for the corresponding properties.

For example the following configuration:

fake:
  type: object
  properties:
    first-name:
      type: firstname
    last-name:
      type: lastname
    email:
      type: email
    phones:
      type: array
      item:
        type: phoneformatted
      count: 3

will produce next data (pay attention response was formatter for better readability):

{
  "email": "amparobogan@hauck.org",
  "first-name": "Kyla",
  "last-name": "Tromp",
  "phones": [
    "646-197-4242",
    "1-849-783-9215",
    "1-953-147-0257"
  ]
}

Array definition

type: array
seed: <randomizing-seed>
item: <item-definition>
count: <items-count>

Where:

  • - The seed for generator to freeze generated value
  • - The node definition for array items.
  • - Count of generated items.

For example the following configuration:

type: array
item:
  type: object
  properties:
    first-name:
      type: firstname
    last-name:
      type: lastname
    about:
      type: sentence
      options:
        wordcount: 15
count: 3

will produce next data (pay attention response was formatter for better readability):

[
  {
    "about":"Of most now summation whom pretty yet about scary thing shirt those an that within.",
    "first-name":"Sheila",
    "last-name":"Auer"
  },
  {
    "about":"Whom fight sufficient my lately then been generally these knit quarterly of his there could.",
    "first-name":"Precious",
    "last-name":"Dicki"
  },
  {
    "about":"Finnish Caesarian goal anybody tomorrow itself then entirely whale behind German regularly within boots this.",
    "first-name":"Kody",
    "last-name":"Larson"
  }
]

Primitive types

To configure a concrete primitive type you can use folofing structure:

type: <data-type>
seed: <randomizing-seed>
options:
  <param1>: <param1-value>
  <param2>: <param2-value>
  <param3>: <param3-value>

Where:

  • - The key of function generator
  • - The seed for generator to freeze generated value
  • <param1>, <param2>, etc - The keys of options for <data-type> function.
  • <param1-value>, <param2-value>, etc - The values of the corresponding parameters for the generator function.

Example of configuration for sentence data:

type: sentence
options:
  wordcount: 15

That will provide value like this:

"Themselves sock are fly noisily over before secondly nest theirs next is bunch his alternatively."

Changed console render library

The Charm logo

We have updated uncors to use lipgloss as style lib.

Changelog

v0.2.2

04 Jan 17:28
Compare
Choose a tag to compare

Bugfixing

  • Fixed a bug with incorrect Сontent-Encoding on the error page
  • Added logging for default handler errors

Changelog

v0.2.1

13 Dec 15:40
Compare
Choose a tag to compare

Bugfixing

Fixed a bug with incorrect Сontent-Length in specific cases.

Changelog

  • 3346a5d Allowed different values in the Location header
  • 0787263 Removed Content-length from coping
  • 4ecc45e Updated json schema
  • 328f0c1 Updated roadmap

v0.2.0

25 Nov 14:30
Compare
Choose a tag to compare

Response caching

Added in memory response caching for requests. That allows to reduce response time for requests that are repeated often
or have long response time.

Each mapping has own cache settings that can be configured in config file.

mappings:
  - from: localhost
    to: https://github.com
    cache:
      /api/path
      /other-path

By default, cached only GET requests. To enable caching for other methods use methods option in cache-config section:

mappings:
  - from: localhost
    to: https://github.com
    cache: [...]
cache-config:
  methods:
    - GET
    - POST
    - PUT

Also, you can configure cache expiration time and cache clear time.

mappings:
  - from: localhost
    to: https://github.com
    cache: [...]
cache-config:
  methods: [GET, POST]
  expiration-time: 10m
  clear-time: 1h

Config Schema file

Added JSON Schema for configuration file

  • Schema URL: https://raw.githubusercontent.com/evg4b/uncors/develop/schema.json
  • Schema version: JSON Schema version 4
  • File paths patterns: *.uncors.yml, *.uncors.yaml, .uncors.yml, .uncors.yaml

Other points

  • Automatically restarts the server after configuration files change.
  • Config file validation before starting or reloading the server

Changelog

v0.1.0

03 Jun 20:22
Compare
Choose a tag to compare

Changelog

0.0.9

23 Apr 22:46
Compare
Choose a tag to compare
  • Added ability deley mock response via delay property:
mocks:
  - path: /demo
    method: GET
    response:
      code: 200
      delay: 110s
      raw-content: hello word
  • Changed npm distribution library (fixed support npm 8.x)

Changelog

  • 1cdcd43 Delay for mocked response (#11)
  • d70a1f6 Moved new version check login in separated package
  • cc948bc Updated config loading system (#9)
  • b8b21ee Updated npm distribution lib
  • 0595bdb Updated uncors server structure

0.0.8-beta

14 Dec 15:33
Compare
Choose a tag to compare
0.0.8-beta Pre-release
Pre-release

Realise for npm regestry.

Changelog

0.0.8

21 Nov 19:19
Compare
Choose a tag to compare
  • Added ability to pass multiple URL mappings from CLI arguments: uncors --from host1.local --to host1.com --from host2.local --to host2.com ...
  • Added ability to return mock content from file
  • Added disclaimer message
  • Added new version check

Changelog

0.0.7

01 Nov 12:31
78369b9
Compare
Choose a tag to compare
  • Fixed issues mock header writing

Changelog

0.0.6

16 Oct 12:06
Compare
Choose a tag to compare
  • Added uncors to scoop bucket (see more here)
  • Added responce mocks mechanism (see more here)

Changelog

  • c5977e4 Added scoop bucket configuration
  • bb59aad Added tests for Make replacer method
  • c96105b Changed graceful shutdown mechanism
  • fffece1 Cleanup code
  • fc9bc7b Fixed publishing
  • 0a673b0 Merge proxy and options midelwares
  • 432577a Replace default mux to gorilla/mux
  • 9c2bfa1 Responce mocks (#3)
  • bfe40b0 Transform middleware to simple http handler