Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/http/src/validator/deserializers/style/label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ export function deserializeLabelStyle(
): unknown {
const type = schema ? schema.type : 'undefined';

if (!parameters[name].startsWith('.')) {
if (!parameters[name].toString().startsWith('.')) {
throw new Error('Label serialization style requires parameter to be prefixed with "."');
}

const value = parameters[name].substr(1);
const value = parameters[name].toString().substring(1);

if (type === 'array') {
return deserializeArray(value, explode);
Expand Down
8 changes: 4 additions & 4 deletions packages/http/src/validator/deserializers/style/matrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ export function deserializeMatrixStyle(
): unknown {
const type = schema ? schema.type : 'undefined';

if (!parameters[name].startsWith(';')) {
if (!parameters[name].toString().startsWith(';')) {
throw new Error('Matrix serialization style requires parameter to be prefixed with ";"');
}

const value = parameters[name].substr(1);
const value = parameters[name].substring(1);

if (type === 'array') {
return explode ? deserializeImplodeArray(name, value) : deserializeArray(name, value);
Expand All @@ -28,11 +28,11 @@ export function deserializeMatrixStyle(

function deserializePrimitive(name: string, value: string) {
const prefix = name + '=';
if (!value.startsWith(prefix)) {
if (!value.toLowerCase().startsWith(prefix)) {
throw new Error('Matrix serialization style requires parameter to be prefixed with name');
}

return value.substr(prefix.length);
return value.substring(prefix.length);
}

function deserializeArray(name: string, value: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function deserializeSimpleStyle(
explode?: boolean
): unknown {
const type = schema ? schema.type : 'undefined';
const value = parameters[name];
const value = parameters[name] == undefined ? parameters[name] : parameters[name].toString();

if (type === 'array') {
return deserializeArray(value);
Expand Down
Loading