implemented Helpers.makeHttps
This commit is contained in:
@@ -25,6 +25,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
module Helpers (
|
||||
textToUrl,
|
||||
urlToText,
|
||||
makeHttps,
|
||||
editHost
|
||||
) where
|
||||
|
||||
@@ -63,6 +64,15 @@ urlToText url = T.pack $
|
||||
Just str -> "#" ++ str
|
||||
Nothing -> ""
|
||||
|
||||
-- | Convert HTTP to HTTPS (if necessary)
|
||||
makeHttps :: Url -> Maybe Url
|
||||
makeHttps url = if any ($ protocol url)
|
||||
[ (== "https")
|
||||
, (== "http")
|
||||
]
|
||||
then Just url { protocol = "https" }
|
||||
else Nothing
|
||||
|
||||
-- | Edit the 'host' value of a 'Url'
|
||||
editHost
|
||||
:: (String -> Maybe String)
|
||||
|
||||
Reference in New Issue
Block a user