Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Interfaces/Helpers/URLHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ QString URLHelper::domain(QString _url, bool _stripProtocol) {
Domain.chop(1);

if (_stripProtocol) {
if (_url.startsWith("http://"))
if (Domain.startsWith("http://"))
Domain = Domain.mid(7);
else if (_url.startsWith("https://"))
else if (Domain.startsWith("https://"))
Domain = Domain.mid(8);
}

Expand Down
11 changes: 11 additions & 0 deletions unitTest/testMacros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ using namespace std;
#include "Interfaces/Common/QtTypes.hpp"
#include "Interfaces/Common/GenericTypes.h"
#include "Interfaces/Helpers/IteratorHelper.hpp"
#include "Interfaces/Helpers/URLHelper.h"

using namespace Targoman;
using namespace Targoman::API::Helpers;
Expand Down Expand Up @@ -396,6 +397,16 @@ private slots:
;
}

void test_URLHelper() {
qDebug() << URLHelper::domain("Dev.Test", false);
qDebug() << URLHelper::domain("http://Dev.Test", false);
qDebug() << URLHelper::domain("https://Dev.Test", false);

qDebug() << URLHelper::domain("Dev.Test", true);
qDebug() << URLHelper::domain("http://Dev.Test", true);
qDebug() << URLHelper::domain("https://Dev.Test", true);
}

};

#endif // TESTMACROS_HPP