http-client icon indicating copy to clipboard operation
http-client copied to clipboard

Add setting for traditional buildQueryString

Open zakjan opened this issue 9 years ago • 4 comments

buildQueryString in aurelia-path has tradidional argument which triggers different way to format query params.

Currently HttpClient doesn't have similar param, therefore I have to build the query manually and append to url instead of using withParams RequestBuilder method.

zakjan avatar Jan 25 '17 10:01 zakjan

Hi @EisenbergEffect Is it okay to add traditional flag into the signature method of withParams? Something like the code below.

  withParams(params: Object, traditional ?: boolean): RequestBuilder {
    return this._addTransformer(function(client, processor, message) {
      message.traditional = traditional;
      message.params = params;
    });
  }

and also with get method

  get(url: string, params?: Object, traditional?: boolean): Promise<HttpResponseMessage> {
    return this.createRequest(url).asGet().withParams(params, traditional).send();
  }

any thoughts?

jmvtrinidad avatar Jul 19 '17 07:07 jmvtrinidad

I think it would be better to have a requestOptions argument. The property traditional will then be a property on the requestOptions object. This way it will be easier to add/remove/modify options that might come in the future. I personally hate methods which parameter signature changes frequently or has a long list of parameters.

CasiOo avatar Aug 13 '17 21:08 CasiOo

The method signature is somewhat the same as buildQueryString method. Also, changes do not affect existing code. The actual traditional option is included as property of AureliaHttpClient class along with other options.

jmvtrinidad avatar Aug 14 '17 10:08 jmvtrinidad

Looks like traditional is now supported. This issue can now be close I believe

JinsPeter avatar Dec 10 '21 19:12 JinsPeter