NG-ZORRO / rebirth-http

Java JPA like HTTP client for Angular. 🍙
MIT License
57 stars 12 forks source link

怎么添加 withCredentials? #7

Closed consilient-hengtian closed 6 years ago

greengerong commented 7 years ago

可以选择在拦截器中添加 withCredentials,或者是class级别 @DefaultHeaders(headers: Object)、方法级别@Header(key: string)添加。

 @Cacheable({ pool: 'articles' })
 @GET('article')
 fetchArticles(@Query('pageIndex') pageIndex = 1,
            @Query('pageSize') pageSize = 10,
            @Header('withCredentials')  withCredentials: boolean,
            @Query('keyword') keyword?: string): Observable<SearchResult<Article>> {
       return null;
  }

或者:

@Injectable()
@DefaultHeaders({
       withCredentials: true
 })
 export class OnlineArticleService extends RebirthHttp implements IArticleService {

  }

image