Rails 5 で API を構築しており、 curl またはhttpieを使用してコマンド ラインでローカルにポスト リクエストをテストしようとしています。
ただし、constraints subdomain: 'api'
ルートで使用していますが、curl と httpie の両方が気に入りません。Chrome を開いて に移動するとhttp://api.localhost:3000/v1/users
、有効な応答が返されます。ただし、httpie を使用すると、次のエラーが発生します。
http: error: ConnectionError: HTTPConnectionPool(host='api.localhost', port=3000):
Max retries exceeded with url: /v1/users (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection
object at 0x105732550>: Failed to establish a new connection: [Errno 8]
nodename nor servname provided, or not known',)) while doing GET request to
URL: http://api.localhost:3000/v1/users
これはサブドメインが原因であるとほぼ確信していますが、curlまたはhttpieでサブドメインを使用することについて言及しているドキュメントはどこにも見つかりません。これどうやってするの?