如何解决NsWag Swagger-如何从组件获取URL服务
如何从组件中获取url服务?我需要执行其他操作(即:保存在本地存储网址上)
在nswag生成的我的service-proxy上,这是生成的代码:
@Injectable()
export class LocationServiceProxy {
private http: HttpClient;
private baseUrl: string;
protected jsonParseReviver: ((key: string,value: any) => any) | undefined = undefined;
constructor(@Inject(HttpClient) http: HttpClient,@Optional() @Inject(API_BASE_URL) baseUrl?: string) {
this.http = http;
this.baseUrl = baseUrl ? baseUrl : "";
}
/**
* @param body (optional)
* @return Success
*/
saveLocations(body: LocationIODto | undefined): Observable<LocationIODto> {
let url_ = this.baseUrl + "/api/services/app/Location/SaveLocations";
url_ = url_.replace(/[?&]$/,"");
const content_ = JSON.stringify(body);
let options_ : any = {
body: content_,observe: "response",responseType: "blob",headers: new HttpHeaders({
"Content-Type": "application/json-patch+json","Accept": "text/plain"
})
};
我需要做一些(从我的组件中)this.locationService.GetUrl()或类似操作,是否有配置来自动生成此方法?并检索 url 参数?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。