protected static async Task<IRootResourceObject> GetFreshRootResourceAsync(IHalHttpClient client, IHalHttpClientConfiguration config)
		{
			if (config.BaseAddress == null)
				throw new InvalidOperationException("The root resource can only be requested for caching if the BaseAddress of the client is initialized in the Configure method of the factory.");

			return await client.GetAsync(config.BaseAddress).ConfigureAwait(false);
		}
Beispiel #2
0
 protected override void Configure(IHalHttpClientConfiguration config, T context)
 {
     if (OnConfigure != null)
     {
         OnConfigure(config, context);
     }
     else
     {
         base.Configure(config, context);
     }
 }
        protected override void Configure(IHalHttpClientConfiguration client)
        {
            if (_settings.Timeout != default(TimeSpan))
            {
                client.Timeout = _settings.Timeout;
            }

            if (_settings.MaxResponseContentBufferSize != default(long))
            {
                client.MaxResponseContentBufferSize = _settings.MaxResponseContentBufferSize;
            }

            client.BaseAddress = _settings.BaseAddress;
            client.Headers.Add("Authorization", string.Format("findsi_api_key apikey=\"{0}\"", _settings.Key));
        }
 protected virtual void Configure(IHalHttpClientConfiguration config)
 {
     // Do nothing by default ...
 }
        protected static async Task <IRootResourceObject> GetFreshRootResourceAsync(IHalHttpClient client, IHalHttpClientConfiguration config)
        {
            if (config.BaseAddress == null)
            {
                throw new InvalidOperationException("The root resource can only be requested for caching if the BaseAddress of the client is initialized in the Configure method of the factory.");
            }

            var message = await client.GetAsync(config.BaseAddress).ConfigureAwait(false);

            return(message.Resource);
        }
 protected virtual void Configure(IHalHttpClientConfiguration client)
 {
     // Do nothing by default ...
 }
 protected abstract void Configure(IHalHttpClientConfiguration config, T context);