Home About

All posts tagged with "HttpClient"

The HttpClient is a class used to make HTTP requests and receive HTTP responses. It has methods for all the different HTTP verbs: GET, PUT, POST, DELETE etc

Page 1 of 1

C# - How to set a BaseAddress using the HttpClient

If you would rather work with relative URLs than absolute URLs you can use the BaseAddress property of the HttpClient. All you have to do is »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on HttpClient, C# 08 May 2022

C# - Set the URL per request using the HttpClient

This might seem trivial, but since I got the question the other day I might as well make a post about it. Using the HttpClient in »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on HttpClient, C# 08 May 2022

C# - How to call the Yahoo Finance API in .Net

Yahoo has one of the best free financial APIs out there and in this post you will see an example of how to call it. Yahoo »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on finance, .Net, HttpClient, HTTP 14 November 2021

C# HttpClient - How to send a HTTP request with a specifc header

I needed to set a header while using the HTTPClient in C# for another blog post. I thought this was quite trivial using the GetAsync, PostAsync »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on HttpClient, C#, .Net, HTTP 06 September 2021

C# - How to set the encoding of a request using the HttpClient

In this post I demonstrate how you can change the Encoding when using the HTTPClient in C#. To show you how I have created a simple »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on HttpClient, Encoding 26 December 2020

C# - How to PUT or POST JSON using the HTTPClient in .Net core

In this post I demonstrate how you can POST or PUT JSON using the HTTPClient in C#. The simplest way to do this is using the »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on HttpClient, C#, Web 24 October 2020

C# - How to put or post XML using the HttpClient in .Net Core

It is quite easy to send XML using the HttpClient in asp.net core. In order to do this you need to use the StringContent object, »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on C#, HttpClient, Web 23 September 2020

.Net core HttpClient - how to set content-type for a request

For some reason I can never remember how to make a POST or PUT request with a content-type other than JSON or XML. For JSON and »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on HttpClient, .Net, .Net core, C# 01 February 2020

C# - How to mock the HttpClient for tests when it is a dependency

In this post I will go through how you can mock the HttpClient class in C#. This is often needed as everything we develop these days »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on HttpClient, HTTP, C#, Dependency injection, Test doubles, Mocking 11 October 2018
Page 1 of 1
Rss
Twitter
LinkedIn
profile for Peter Rasmussen at Stack Overflow, Q&A for professional and enthusiast programmers
Peter Daugaard Rasmussen - developer, Consultant, Blogger © 2022 Cookie policy