diff --git a/src/uri.cpp b/src/uri.cpp
index 0e266634773974f15643a0b642647cc9ba719aac..96dc4292850687b29b0d20ba784ddd9dcb1da31d 100644
--- a/src/uri.cpp
+++ b/src/uri.cpp
@@ -517,6 +517,15 @@ QString URI::userinfo() const
    return d_ptr->m_Userinfo;
 }
 
+/**
+ * Sometime, some metadata can be used to deduce the scheme even if it wasn't
+ * originally known. This will improve the result of ::format.
+ */
+void URI::setSchemeType(SchemeType t)
+{
+    d_ptr->m_HeaderType = t;
+}
+
 /**
  * Generate a new URI formatted with the sections passed in `sections`
  *
diff --git a/src/uri.h b/src/uri.h
index 5ff0e779407222ce0e0be055b8f59000955013eb..dadbb40961d8fa9454f19fa61169a064cf6441d8 100644
--- a/src/uri.h
+++ b/src/uri.h
@@ -178,6 +178,9 @@ public:
    SchemeType schemeType    () const;
    ProtocolHint protocolHint() const;
 
+   //Setter
+   void setSchemeType(SchemeType t);
+
    //Converter
    QString format(FlagPack<URI::Section> sections) const;