任何人都可以回答我的以下问题
我想通过c#代码为所有回复添加customHeaders。
使用c#
答案 0 :(得分:0)
您可以像这样发送
const resize = (filepath: string, output: string, width: number = 256, height: number = 256) => {
const proc = spawn("gm", ["convert", filepath, "-resize", `${width}x${height}`, output]);
return new Promise((resolve, reject) => {
let err = "";
proc.stderr.on("data", chunk => {
err += chunk.toString();
});
const onEnd = (code: number) => (code ? reject(err) : resolve());
proc.on("close", onEnd);
proc.on("end", onEnd);
});
};
resize("C:/Users/Desktop/file.jpg", "C:/Users/Desktop/sfile.jpg");
答案 1 :(得分:0)
将middleware插入管道:
app.Use(async (context, next) =>
{
context.Response.Headers.Add("Time-Allow-Origin", new[] { "value1", "value2", "value3" });
await next();
});