fastify/fast-uri

Encoding colon in the URL path

ivan-tymoshenko opened this issue · 1 comments

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the issue has not already been raised

Issue

I'm facing an error when replacing uri-js with fast-uri in ajv. I think it has to do with colon encoding.

'use strict';

const assert = require('assert')

const fastUri = require('fast-uri')
const uriJs = require('uri-js')

const data = {
  fragment: '/definitions/foo',
  path: 'to:local',
  reference: 'uri',
  scheme: 'relative',
}

assert.equal(
  fastUri.serialize(data), // 'relative:to%3Alocal#/definitions/foo'
  uriJs.serialize(data) // 'relative:to:local#/definitions/foo'
)

The original JSON schema is here: https://github.com/fastify/fast-json-stringify/blob/6ae2ae757f10f2491c0976bef44ff9fc4dd8f217/test/ref.test.js#L912

zekth commented

Good call. Could you make a PR for this?