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
F14447854: D9386.id22382.diff
Thu, Dec 26, 2:37 PM
F14446176: D9386.id22395.diff
Thu, Dec 26, 1:07 PM
Unknown Object (File)
Mon, Dec 23, 4:39 AM
Unknown Object (File)
Sat, Dec 21, 6:41 PM
Unknown Object (File)
Fri, Dec 20, 9:43 PM
Unknown Object (File)
Sat, Dec 14, 10:03 PM
Unknown Object (File)
Thu, Dec 12, 9:19 PM
Unknown Object (File)
Tue, Dec 10, 8:04 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).