Skip to content

Commit

Permalink
extract trim
Browse files Browse the repository at this point in the history
  • Loading branch information
ericminio committed Apr 25, 2024
1 parent da29c8a commit 0b7eda8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions stub-json/about/tests.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash

source ../support/nginx/reload.sh
source ../support/trim.sh

function test_json_header {
nginx_reload_configuration
type=$(curl --head http://localhost:8080/json | grep "Content-Type:")
trimmed=$(echo "$type" | sed 's/\r//g' | xargs echo -n)
type=$(curl --head http://localhost:8080/json | grep "Content-Type:" | trim)

assertequals "$trimmed" "Content-Type: application/json"
assertequals "$type" "Content-Type: application/json"
}
5 changes: 5 additions & 0 deletions support/trim.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

function trim {
sed 's/\r//g' | xargs echo -n
}

0 comments on commit 0b7eda8

Please sign in to comment.