http_set_header

追加 HTTP ヘッダの設定

http_set_header "header_string"

"header_string" : "Authorization: Bearer xxx\r\n" 等の追加ヘッダ

(プラグイン / モジュール : iron_http.hsp)

解説

Content-Type 以外の追加ヘッダを後続の http_get/http_post に付与します。
Authorization, X-API-Key, User-Agent カスタム等に使用。
空文字でクリア。

例:
  http_set_header "Authorization: Bearer sk-..."
  http_get "https://api.openai.com/v1/models", body

サンプル逆引き (1)

sample_cam_ai.hsp

情報

プラグイン / モジュールiron_http.hsp
バージョン1.0
作成日2026-04-14
著作者IronHSP / iron_http
URLhttps://github.com/inovia/IronHSP
備考iron_http.hsp は Win32 WinHTTP API を直接ラップした HTTP クライアント
モジュールです。.NET 不要、HTTPS 自動 (システム証明書ストア使用)、
リダイレクト自動追尾。

#include "iron_http.hsp"

GET / POST を 1 行で叩けます。応答 body は出力 var に書き込まれ、
HTTP status は stat システム変数に入ります。
タイプ拡張命令
グループiron_http
対応環境
  • その他 : Win32 / Win64
hs ファイルhsphelp\iron_http.hs