LoginSignup
23
16

More than 5 years have passed since last update.

rubyでアンダースコアの混じったURIは使えない

Last updated at Posted at 2012-12-10

ちょっとハマったのでメモ

テストの時に外部APIにアクセスするURIを

test_server

とか使っていて

/etc/hostsにもテスト用のサーバーの設定を追加して

127.0.0.1 test_server

コマンドラインから ping も通るのに

rubyでこのURIを使用すると

URI::InvalidURIError:
       the scheme http does not accept registry part: test_server (or bad hostname?)

とかって例外が発生する。
rfcとかだと最新は、使って良いらしいんだけど...

で、アンダースコアを"-"とかに変更すると許してもらえた。

test-server
23
16
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
23
16