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)
Sun, Nov 10, 7:44 AM
Unknown Object (File)
Fri, Nov 8, 8:35 PM
Unknown Object (File)
Fri, Nov 8, 7:45 PM
Unknown Object (File)
Sat, Nov 2, 6:43 AM
Unknown Object (File)
Oct 18 2024, 2:05 PM
Unknown Object (File)
Oct 16 2024, 7:52 AM
Unknown Object (File)
Oct 16 2024, 7:00 AM
Unknown Object (File)
Oct 10 2024, 10:33 AM
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).