3
requestjsを使用してJSONベースのAPIを呼び出そうとしていますが、サーバーからエラーが発生しています。node.js requestjsがcurlに失敗する
request.get({
url: 'https://api.myapi.com',
timeout: 120000,
headers: {
username: 'myuser',
password: 'mypassword'
}
}, function (err, result) {
...
}
)
エラー:
java.lang.IndexOutOfBoundsException: Index: 0
java.util.Collections$EmptyList.get(Collections.java:4454)
com.itemmaster.api.rest.svc.authentication.OpenSSOUserAuthServiceImpl.authenticate(OpenSSOUserAuthServiceImpl.java:159)
com.itemmaster.api.rest.profiler.SecurityProfiler.profile(SecurityProfiler.java:58)
いかなる問題なくカールリターンを使用して同じコールを実行中。
curl --header "username:myuser" --header "password:mypassword" 'https://api.myapi.com'
、エラーは何ですか? – MinusFour
ヘッダーの下のユーザー名/パスワードを渡さないと、その認証情報を呼び出す必要があります – JordanHendrix