MCPcopy
hub / github.com/httpie/cli / _process_url

Method _process_url

httpie/cli/argparser.py:205–225  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

203 }
204
205 def _process_url(self):
206 if self.args.url.startswith('://'):
207 # Paste URL & add space shortcut: `http ://pie.dev` → `http://pie.dev`
208 self.args.url = self.args.url[3:]
209 if not URL_SCHEME_RE.match(self.args.url):
210 if os.path.basename(self.env.program_name) == 'https':
211 scheme = 'https://'
212 else:
213 scheme = self.args.default_scheme + '://'
214
215 # See if we're using curl style shorthand for localhost (:3000/foo)
216 shorthand = re.match(r'^:(?!:)(\d*)(/?.*)$', self.args.url)
217 if shorthand:
218 port = shorthand.group(1)
219 rest = shorthand.group(2)
220 self.args.url = scheme + 'localhost'
221 if port:
222 self.args.url += ':' + port
223 self.args.url += rest
224 else:
225 self.args.url = scheme + self.args.url
226
227 def _setup_standard_streams(self):
228 """

Callers 1

parse_argsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected