<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="330809" data-post-id="330809">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="soyjeansoy" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/soyjeansoy/120/35385_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  soyjeansoy
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><a class="mention" href="/u/gmile" rel="nofollow">@gmile</a> this is a test file for posting page views in analytics (using <a href="https://hex.pm/packages/exvcr" rel="nofollow">exvcr</a>):</p>
<ul>
<li>Phx v1.7.12</li>
<li>Bandit v1.2</li>
<li>Exvcr v0.15</li>
<li>osx sonoma</li>
<li>Elixir 1.16.2 (asdf)</li>
</ul>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule MyAppWeb.AnalyticsTest do
  use ExUnit.Case, async: true
  use ExVCR.Mock, adapter: ExVCR.Adapter.Httpc

  setup_all do
    :inets.start()
    # :ssl.start()
    :ok
  end

  test "increment pageviews to analytics" do
    use_cassette "post data to analytics" do
      uri =
        %URI{
          scheme: "https",
          host: "analytics.domain.com",
          path: "/api/event"
        }

      payload =
        %{
          domain: "analytics.local",
          name: "analytics",
          url: "http://127.0.0.1:4000"
        }

      http_opts = [
        # ssl: [
        #   versions: [~c"tlsv1.2"],
        #   verify: :verify_none,
        #   cacerts: :public_key.cacerts_get(),
        #   customize_hostname_check: [
        #     match_fun: :public_key.pkix_verify_hostname_match_fun(:https)
        #   ]
        # ],
        # timeout: 3_600,
        # connect_timeout: 3_600
      ]

      request = {
        URI.to_string(uri),
        [{~c"X-Forwarded-For", ~c"127.0.0.1"}],
        ~c"application/json",
        Jason.encode!(payload)
      }

      {:ok, result} = :httpc.request(:post, request, http_opts, [])
      {{_http_version, status_code, _reason_phrase}, _headers, body} = result
      code = Plug.Conn.Status.code(:accepted)
      assert status_code == code
    end
  end
end
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="330809" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/httpc-cheatsheet/50337/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-330809" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="330809"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="334603" data-post-id="334603">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="gmile" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/gmile/120/33982_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  gmile
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="ghannam80" data-post="11" data-topic="50337">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/ghannam80/48/35232_2.png" class="avatar"> ghannam80:</div>
<blockquote>
<p>Do erlang have a library that can be used with :httpc to support request signing using RSA keys in line with OAUTH specs</p>
</blockquote>
</aside>
<p>There’s <a href="https://github.com/lexmag/oauther" class="inline-onebox" rel="noopener nofollow ugc">GitHub - lexmag/oauther: OAuth 1.0 for Elixir · GitHub</a>, though the library appears quite dated I won’t be surprised it it’s still works - I doubt the standard has changed significantly in the past years <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"> Perhaps something else exists these days too, I am not sure.</p>
<p>Also, a shallow search on GitHub reveals various projects implement signing of request body themselves <img src="https://forum.elixirforum.com/images/emoji/apple/thinking.png?v=15" title=":thinking:" class="emoji" alt=":thinking:" loading="lazy" width="20" height="20"> <a href="https://github.com/search?q=oauth_nonce+oauth_signature_method+language%3Aerlang&amp;type=code" class="inline-onebox" rel="noopener nofollow ugc">Code search results · GitHub</a></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="334603" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/httpc-cheatsheet/50337/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-334603" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="334603"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="334613" data-post-id="334613">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="gmile" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/gmile/120/33982_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  gmile
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="soyjeansoy" data-post="8" data-topic="50337">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/soyjeansoy/48/35385_2.png" class="avatar"> soyjeansoy:</div>
<blockquote>
<p>For some odd reason whenever I pass this opts (this is for <code>test</code> environment), it threw an error:</p>
</blockquote>
</aside>
<p>Are you by any chance getting an error that looks like this too?</p>
<p></p><div class="lightbox-wrapper"><a class="lightbox" href="https://forum.elixirforum.com/uploads/default/original/3X/b/0/b0a825522b007c5413208705938086ff4229d57b.jpeg" data-download-href="https://forum.elixirforum.com/uploads/default/b0a825522b007c5413208705938086ff4229d57b" title="CleanShot 2024-07-16 at 16.45.23@2x" rel="nofollow"><img src="https://forum.elixirforum.com/uploads/default/optimized/3X/b/0/b0a825522b007c5413208705938086ff4229d57b_2_690x167.jpeg" alt="CleanShot 2024-07-16 at 16.45.23@2x" data-base62-sha1="pcMhHom6fgXJldBBzJEeeyePLC3" width="690" height="167" srcset="https://forum.elixirforum.com/uploads/default/optimized/3X/b/0/b0a825522b007c5413208705938086ff4229d57b_2_690x167.jpeg, https://forum.elixirforum.com/uploads/default/optimized/3X/b/0/b0a825522b007c5413208705938086ff4229d57b_2_1035x250.jpeg 1.5x, https://forum.elixirforum.com/uploads/default/original/3X/b/0/b0a825522b007c5413208705938086ff4229d57b.jpeg 2x" data-dominant-color="272233"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">CleanShot 2024-07-16 at 16.45.23@2x</span><span class="informations">1200×292 32.3 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><p></p>
<p>The error from screenshot is coming from VCR:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">code: {:ok, result} = :httpc.request(:post, request, http_opts, [])
stacktrace:
  (elixir 1.17.0) lib/list.ex:1084: List.to_string/1
  (exvcr 0.15.1) lib/exvcr/adapter/httpc/converter.ex:6: anonymous fn/1 in ExVCR.Adapter.Httpc.Converter.parse_keyword_list/1
  (elixir 1.17.0) lib/enum.ex:1703: Enum."-map/2-lists^map/1-1-"/2
  (exvcr 0.15.1) lib/exvcr/adapter/httpc/converter.ex:64: ExVCR.Adapter.Httpc.Converter.request_to_string/1
  (exvcr 0.15.1) lib/exvcr/adapter/httpc/converter.ex:6: ExVCR.Adapter.Httpc.Converter.convert_to_string/2
  (exvcr 0.15.1) lib/exvcr/handler.ex:235: ExVCR.Handler.get_response_from_server/3
  help-forum.exs:43: (test)
</code></pre>
<p>I’d suggest perhaps ExVCR, while serializing a request to cassette file, it stumbles upon writing SSL certificates, which are represented as binaries and cannot be dumped as mere strings. But this is a pure speculation, I am not sure how VCR works.</p>
<p>ExVCR also has this open issue, it contains a somewhat similar error: <a href="https://github.com/parroty/exvcr/issues/105" class="inline-onebox" rel="noopener nofollow ugc">TLS 1.2 ssl doesn't work for hackney (httpoison) · Issue #105 · parroty/exvcr · GitHub</a></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="334613" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/httpc-cheatsheet/50337/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-334613" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="334613"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>