summaryrefslogtreecommitdiff
path: root/test/support/dummy_endpoint.ex
diff options
context:
space:
mode:
Diffstat (limited to 'test/support/dummy_endpoint.ex')
-rw-r--r--test/support/dummy_endpoint.ex30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/support/dummy_endpoint.ex b/test/support/dummy_endpoint.ex
new file mode 100644
index 0000000..9b0ea32
--- /dev/null
+++ b/test/support/dummy_endpoint.ex
@@ -0,0 +1,30 @@
+# Copyright 2020 Hubert Chathi <hubert@uhoreg.ca>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+defmodule DummyEndpoint do
+ @enforce_keys [:http_spec]
+ defstruct [
+ :http_spec
+ ]
+
+ defimpl Polyjuice.Client.Endpoint.Proto do
+ def http_spec(%{http_spec: http_spec}, base_url) do
+ %{http_spec | url: URI.merge(base_url, http_spec.url) |> to_string()}
+ end
+
+ def transform_http_result(req, status_code, resp_headers, body) do
+ Polyjuice.Client.Endpoint.parse_response(req, status_code, resp_headers, body)
+ end
+ end
+end