@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Added 'method' field to the HTTP request build step.

Summary:
This revision adds a 'method' field to the HTTP request harbormaster build step. This allows the user to specify GET, POST, DELETE, and PUT (limited by the underlying wrapper phabricator uses for HTTP requests). I'm not sure how much sense PUT makes, but oh well.

Existing plans shouldn't break, as if this field is an empty string, we default to POST, which is the old behavior.

Fixes T4604

Test Plan: 1) Verified that the empty string does, in fact, issue a POST request. Changed the method to be GET and observed that the problem described in T4604 is resolved.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: aran, epriestley

Maniphest Tasks: T4604

Differential Revision: https://secure.phabricator.com/D8520

authored by

William R. Otte and committed by
epriestley
29436dfe e6118bcb

+19 -2
+19 -2
src/applications/harbormaster/step/HarbormasterHTTPRequestBuildStepImplementation.php
··· 16 16 17 17 $uri = new PhutilURI($settings['uri']); 18 18 $domain = $uri->getDomain(); 19 - return pht('Make an HTTP request to %s', $domain); 19 + return pht('Make an HTTP %s request to %s', $settings['method'], $domain); 20 20 } 21 21 22 22 public function execute( ··· 34 34 $log_body = $build->createLog($build_target, $uri, 'http-body'); 35 35 $start = $log_body->start(); 36 36 37 + $method = 'POST'; 38 + if ($settings['method'] !== '') { 39 + $method = $settings['method']; 40 + } 41 + 37 42 list($status, $body, $headers) = id(new HTTPSFuture($uri)) 38 - ->setMethod('POST') 43 + ->setMethod($method) 39 44 ->setTimeout(60) 40 45 ->resolve(); 41 46 ··· 54 59 return false; 55 60 } 56 61 62 + if ($settings['method'] === null || $settings['method'] != '' && 63 + !in_array ($settings['method'], 64 + array('GET', 'PUT', 'DELETE', 'POST'))) { 65 + return false; 66 + } 67 + 57 68 return true; 58 69 } 59 70 ··· 62 73 'uri' => array( 63 74 'name' => 'URI', 64 75 'description' => pht('The URI to request.'), 76 + 'type' => BuildStepImplementation::SETTING_TYPE_STRING, 77 + ), 78 + 'method' => array( 79 + 'name' => 'Method', 80 + 'description' => 81 + pht('Request type. Should be GET, POST, PUT, or DELETE.'), 65 82 'type' => BuildStepImplementation::SETTING_TYPE_STRING, 66 83 ), 67 84 );