<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Checking on Gopher Coding</title><link>https://gophercoding.com/tags/checking/</link><description>Recent content in Checking on Gopher Coding</description><generator>Hugo</generator><language>en-gb</language><lastBuildDate>Mon, 04 Nov 2024 09:41:37 +0000</lastBuildDate><atom:link href="https://gophercoding.com/tags/checking/index.xml" rel="self" type="application/rss+xml"/><item><title>Check If a URL is Valid</title><link>https://gophercoding.com/is-url-valid/</link><pubDate>Mon, 04 Nov 2024 08:00:00 +0000</pubDate><guid>https://gophercoding.com/is-url-valid/</guid><description>&lt;p>This is just a quick post showing how we can check if a &lt;a href="https://en.wikipedia.org/wiki/URL">URL&lt;/a> is a valid one. URLs are often passed from &lt;strong>third parties&lt;/strong> or user input, so they need to be checked before used. This function allows you to do just that, it will return &lt;em>true&lt;/em> if the string is a valid URL. Feel free to copy and paste it and go from there.&lt;/p>
&lt;p>e.g. valid &amp;ldquo;&lt;a href="https://gophercoding.com/%22">https://gophercoding.com/&amp;quot;&lt;/a>&lt;/p>
&lt;p>e.g. invalid &amp;ldquo;test string&amp;rdquo;&lt;/p></description></item><item><title>Get Status Code from HTTP Request</title><link>https://gophercoding.com/get-status-code-from-http-req/</link><pubDate>Sun, 23 Oct 2022 07:00:00 +0000</pubDate><guid>https://gophercoding.com/get-status-code-from-http-req/</guid><description>&lt;p>We won&amp;rsquo;t go into too much detail about &lt;a href="https://en.wikipedia.org/wiki/List_of_HTTP_status_codes">HTTP status codes&lt;/a> themselves, but in this post we will talk about how to use the &lt;strong>status code&lt;/strong> after making a request, how to check them as a range and how to print them as text. This is often important so we can check if something was successful or failed.&lt;/p>
&lt;p>You can always get this data if you have a &lt;code>net/http/Response&lt;/code> type (&lt;a href="https://go.dev/src/net/http/response.go">spec&lt;/a>).&lt;/p></description></item></channel></rss>