Page MenuHomePhabricator

Post data to the Aphlict server in JSON encoded form.
ClosedPublic

Authored by joshuaspence on Jun 5 2014, 6:55 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 24, 7:01 AM
Unknown Object (File)
Mon, Apr 22, 4:24 PM
Unknown Object (File)
Fri, Apr 19, 3:38 AM
Unknown Object (File)
Fri, Apr 19, 3:38 AM
Unknown Object (File)
Fri, Apr 19, 3:38 AM
Unknown Object (File)
Thu, Apr 11, 4:51 AM
Unknown Object (File)
Mar 14 2024, 1:27 AM
Unknown Object (File)
Feb 14 2024, 9:50 PM
Subscribers

Details

Summary

Ref T4324. Currently, notifications data is POSTed to the Aphlict server in the application/x-www-form-urlencoded format. This works fine for simple data but is problematic for nested data. For example:

array(
  'data' => array(
    'key'  => '6021329908492455737',
    'type' => 'PhabricatorNotificationAdHocFeedStory',
  ),
  'subscribers' => array(
    'PHID-USER-y7ofqm276ejs62yqghge',
  ),
);

Is encoded as data%5Bkey%5D=6021329908492455737&data%5Btype%5D=PhabricatorNotificationAdHocFeedStory&subscribers%5B0%5D=PHID-USER-y7ofqm276ejs62yqghge. This string is then (incorrectly) decoded by querystring.parse as:

> querystring.parse('data%5Bkey%5D=6021329908492455737&data%5Btype%5D=PhabricatorNotificationAdHocFeedStory&subscribers%5B0%5D=PHID-USER-y7ofqm276ejs62yqghge');
{ 'data[key]': '6021329908492455737',
  'data[type]': 'PhabricatorNotificationAdHocFeedStory',
  'subscribers[0]': 'PHID-USER-y7ofqm276ejs62yqghge' }
Test Plan

Sent test notifications from /notification/status/ and verified that the notifications still worked.

Diff Detail

Repository
rP Phabricator
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

joshuaspence retitled this revision from to Post JSON encoded data to the Aphlict server..
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence added a reviewer: epriestley.
joshuaspence set the repository for this revision to rP Phabricator.
joshuaspence retitled this revision from Post JSON encoded data to the Aphlict server. to Post data to the Aphlict server in JSON encoded form..Jun 5 2014, 7:16 AM
joshuaspence edited edge metadata.
joshuaspence updated this object.
joshuaspence updated this object.
joshuaspence updated this object.
epriestley edited edge metadata.
This revision is now accepted and ready to land.Jun 5 2014, 4:46 PM

Maaaaaybe we should be putting JSON in a querystring so we can pass other stuff and clients which can't easily set an entire POST body can do "stuff=".json_encode(...), but we can cross that bridge when we come to it.

epriestley updated this revision to Diff 22395.

Closed by commit rP3202f0f23ddf (authored by @joshuaspence, committed by @epriestley).