Skip to content

Malformed JSON response for POST to /api/v1/push/subscription #14325

@nikclayton

Description

@nikclayton
  • I have searched open and closed issues for duplicates

Bug Description

On pirati.ca the JSON response to a POST to /api/v1/push/subscription contains the JSON response object twice.

I.e., the response is:

{ /* body of response */ }{ /* body of response again */}

Steps to Reproduce

  1. POST to https://pirati.ca/api/v1/subscription/push. You can use dummy values for the mandatory parameters, for example:

subscription[endpoint]=https://example.com
subscription[keys][p256dh]=1
subscription[keys][auth]=2

Form encoded that's:

subscription%5Bendpoint%5D=https%3A%2F%2Fexample.com&subscription%5Bkeys%5D%5Bp256dh%5D=1&subscription%5Bkeys%5D%5Bauth%5D=2

Actual Result:

{"id":"20648","endpoint":"https:\/\/example.com","alerts":{"follow":false,"favourite":false,"reblog":false,"mention":false,"poll":false},"server_key":"BJDaY8cbf6QM82dk2Piv9ADkt-brc3D2I4fJ9dZZNwHsDB61Gxa-sesPo6RVZwJ9hyqkrla94NoStgnl3vIyDpE"}
{"id":"20648","endpoint":"https:\/\/example.com","alerts":{"follow":false,"favourite":false,"reblog":false,"mention":false,"poll":false},"server_key":"BJDaY8cbf6QM82dk2Piv9ADkt-brc3D2I4fJ9dZZNwHsDB61Gxa-sesPo6RVZwJ9hyqkrla94NoStgnl3vIyDpE"}

I've split that on two lines to make the duplication very clear, in reality it's all returned as one line of JSON.

Expected Result:

A single JSON object, e.g.

{"id":"20648","endpoint":"https:\/\/example.com","alerts":{"follow":false,"favourite":false,"reblog":false,"mention":false,"poll":false},"server_key":"BJDaY8cbf6QM82dk2Piv9ADkt-brc3D2I4fJ9dZZNwHsDB61Gxa-sesPo6RVZwJ9hyqkrla94NoStgnl3vIyDpE"}

Platform Info

Friendica Version: pirati.ca reports: This is Friendica, version 2024.06-rc that is running at the web location https://pirati.ca. The database version is 1570/1570, the post update version is 1550/1550.

Pachli ref: pachli/pachli-android#68

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions