上下文:我正在尝试从后端下载二进制文件(需要将一些数据发布为json-body),并使用内容处置标头中后端指定的文件名保存文件保护程序.要访问标题,我想我需要HttpResponse.
但是我无法使用HttpClient.post<T>(...): Observable<HttpResponse<T>>;带有Blob的angular 方法.
我打电话的时候
this.httpclient.post<Blob>('MyBackendUrl',
params,
{observe: 'response', responseType: 'blob'});
the compiler complains about the 'blob' ('json' is accepted by the compiler):
error TS2345: Argument of type '{ observe: "response"; responseType: "blob"; }' is not assignable to parameter of type '{ headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: Ht...'.
Types of property 'observe' are incompatible.
Type '"response"' is not assignable to type '"body"'.
Run Code Online (Sandbox Code Playgroud)
当我把选项放在一个自己的对象中,如/sf/answers/3361165671/所示(但没有"as"...)帖子(...):Observable被调用,我不能访问标题.
顺便说一句,即使是return this.http.get<Blob>('backendUrl', {responseType: 'blob'}); …
有没有办法将Delphi中的嵌套枚举放入自己的命名空间?
此代码生成重新声明的E2004:标识符,因为两个枚举都包含"未知".
TMyType1 = class
public type
TMyType1Enum = (unknown, val1, val2);
public
constructor Create();
...
end;
TMyType2 = class
public type
TMyType2Enum = (unknown, other1, other2, other3); // causes E2004
public
constructor Create();
...
end;
Run Code Online (Sandbox Code Playgroud)
在C++中,枚举元素的标识符都在不同的范围内(TMyType1 :: unknown和TMyType2 :: unknown).
除了标识符的前缀或后缀(MyType1EnumUnknown,MyType1EnumVal1,...,MyType2Enumunknown,...)之外,是否有可能在Delphi中实现类似的功能?