Skip to content

HAL serializer v2 fails if no actions are provided. #8

@inadarei

Description

@inadarei

Unless even empty actions is provided, output is an empty JSON

E.g. this works:

const representor = require('representor-serializer');
response.data = {};
response.data.someAttribute = someValue;
response.actions = [];

// Convert internal representation to HAL
response = representor(response, 'application/hal+json');

But when removing empty .actions code returns an empty object:

const representor = require('representor-serializer');
response.data = {};
response.data.someAttribute = someValue;

// Convert internal representation to HAL
response = representor(response, 'application/hal+json');

return {}

The two should produce identical output

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions