From c9ac6df1ac6459e8ff1ea149f97e117b55ecefd7 Mon Sep 17 00:00:00 2001 From: Fran Casas Date: Tue, 18 Jun 2024 07:50:31 +0200 Subject: [PATCH] fix: link rendering and code highlights (#219) The readme has some links that are not rendering well on https://hexdocs.pm/exvcr, in addition some of the code examples use `Elixir` as language name, so the highlighting doesn't work. I've changed the links so that they render well on hexdocs and rexpect the existing `target="_blank"`. I've also changed the language in the codeblocks so that it is correctly highlighted on both hexdocs and GitHub. --- README.md | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index c9c0df1..5104ca1 100644 --- a/README.md +++ b/README.md @@ -7,23 +7,23 @@ [![License](https://img.shields.io/hexpm/l/exvcr.svg)](http://opensource.org/licenses/MIT) Record and replay HTTP interactions library for Elixir. It's inspired by -Ruby's VCR (https://github.com/vcr/vcr), and trying to provide similar +[Ruby's VCR](https://github.com/vcr/vcr), and trying to provide similar functionalities. ### Basics The following HTTP libraries can be applied. - - ibrowse-based libraries. - - HTTPotion - - hackney-based libraries. - - HTTPoison + - [ibrowse](https://github.com/cmullaparthi/ibrowse){:target="_blank" rel="noopener"}-based libraries. + - [HTTPotion](https://github.com/myfreeweb/httpotion){:target="_blank" rel="noopener"} + - [hackney](https://github.com/benoitc/hackney){:target="_blank" rel="noopener"}-based libraries. + - [HTTPoison](https://github.com/edgurgel/httpoison){:target="_blank" rel="noopener"} - support is very limited, and tested only with sync request of HTTPoison yet. - - httpc-based libraries. - - erlang-oauth - - tirexs + - [httpc](http://erlang.org/doc/man/httpc.html){:target="_blank" rel="noopener"}-based libraries. + - [erlang-oauth](https://github.com/tim/erlang-oauth/){:target="_blank" rel="noopener"} + - [tirexs](https://github.com/Zatvobor/tirexs){:target="_blank" rel="noopener"} - support is very limited, and tested only with `:httpc.request/1` and `:httpc.request/4`. - - Finch + - [Finch](https://github.com/keathley/finch){:target="_blank" rel="noopener"} - the deprecated `Finch.request/6` functions is not supported HTTP interactions are recorded as JSON file. The JSON file can be recorded @@ -64,7 +64,7 @@ using `hackney`, specify `adapter: ExVCR.Adapter.Hackney` options as follows. ##### Example with ibrowse -```Elixir +```elixir defmodule ExVCR.Adapter.IBrowseTest do use ExUnit.Case, async: true use ExVCR.Mock @@ -94,7 +94,7 @@ end ##### Example with hackney -```Elixir +```elixir defmodule ExVCR.Adapter.HackneyTest do use ExUnit.Case, async: true use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney @@ -114,7 +114,7 @@ end ##### Example with httpc -```Elixir +```elixir defmodule ExVCR.Adapter.HttpcTest do use ExUnit.Case, async: true use ExVCR.Mock, adapter: ExVCR.Adapter.Httpc @@ -136,7 +136,7 @@ end ##### Example with Finch -```Elixir +```elixir defmodule ExVCR.Adapter.FinchTest do use ExUnit.Case, async: true use ExVCR.Mock, adapter: ExVCR.Adapter.Finch @@ -161,13 +161,13 @@ end Instead of single `use_cassette`, `start_cassette` and `stop_cassette` can serve as an alternative syntax. -```Elixir +```elixir use_cassette("x") do do_something end ``` -```Elixir +```elixir start_cassette("x") do_something stop_cassette @@ -187,7 +187,7 @@ control rather than just recoding the actual server response. of requesting to server. -```Elixir +```elixir defmodule ExVCR.MockTest do use ExUnit.Case, async: true import ExVCR.Mock @@ -667,7 +667,7 @@ iex(2)> ExVCR.IEx.print(adapter: ExVCR.Adapter.Hackney) do Specifying `:stub` as fixture name allows directly stubbing the response header/body information based on parameter. -```Elixir +```elixir test "stub request works for HTTPotion" do use_cassette :stub, [url: "http://example.com", body: "Stub Response", status_code: 200] do response = HTTPotion.get("http://example.com", []) @@ -733,7 +733,7 @@ If the specified `:url` parameter doesn't match requests called inside the The `:url` can be regular expression string. Please note that you should use the `~r` sigil with `/` as delimiters. -```Elixir +```elixir test "match URL with regular expression" do use_cassette :stub, [url: "~r/(foo|bar)/", body: "Stub Response", status_code: 200] do # ...