##ExcelからREST呼び出しをしたい
ExcelからREST呼び出しを行い、テストケースを管理するのが便利という話を
以前書きました。
実際にやってみると、MSXML2.XMLHTTP.6.0を使用すると、自動的にレスポンスがキャッシュされ、リクエストが発生したりしなかったりと何かと不便です。
##ダミーのパラメータを指定してキャッシュを防ぐ
レスポンスのヘッダーにCache-control: no-cache などを指定することも可能ですが、場合によってはキャッシュするのが正しいケースがあるでしょうから、サービス側に手は入れたくありません。
そこで、以下のようにリクエスト時にダミーのパラメータをセットすることで、キャッシュを回避します。要は、異なるURLになれば良いので、DateTime.Nowなどを用いるのが便利です。
target_url = "http://test.com/api" & "?dummy=" & DateTime.Now