b77f537dc6
- neuron-runtime, neuron-store, neuron-migrate: fix path deps (products/engram/ → foundation/engram/engrams/, products/el/ → foundation/el/engrams/) - neuron-rs workspace: fix axon-events/axon-protocol paths (../../../platform/ → ../../platform/, paths were off by one level) - neuron-lang/compiler/ removed (el self-hosting compiler now lives in foundation/el/el-compiler/)
32 lines
999 B
EmacsLisp
32 lines
999 B
EmacsLisp
// proxy.el — HTTP proxy helpers.
|
|
|
|
import "daemon_config.el"
|
|
|
|
fn proxy_get(target_base: String, path: String, token: String) -> String {
|
|
let url: String = target_base + path
|
|
return http_get_auth(url, token)
|
|
}
|
|
|
|
fn proxy_post(target_base: String, path: String, body: String, token: String) -> String {
|
|
let url: String = target_base + path
|
|
return http_post_auth(url, token, body)
|
|
}
|
|
|
|
fn proxy_request(target_base: String, method: String, path: String, body: String, token: String) -> String {
|
|
if str_eq(method, "GET") {
|
|
return proxy_get(target_base, path, token)
|
|
}
|
|
if str_eq(method, "POST") {
|
|
return proxy_post(target_base, path, body, token)
|
|
}
|
|
if str_eq(method, "PUT") {
|
|
let url: String = target_base + path
|
|
return http_put_auth(url, token, body)
|
|
}
|
|
if str_eq(method, "DELETE") {
|
|
let url: String = target_base + path
|
|
return http_delete_auth(url, token)
|
|
}
|
|
return "{\"error\":\"unsupported method\"}"
|
|
}
|