Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 58d6751

Browse files
committed
Allowing getting the scheme, serverPort, and serverName
Spring-test allows for getting these properties, so the change to throw UnsupportedOperationException when they're retrieved is a backwards-compatibility breaking change. These properties are easy to get from the request URI, so this commit does that.
1 parent d289e04 commit 58d6751

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/groovy/grails/plugin/mail/MailMessageContentRenderer.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,13 +274,13 @@ class MailMessageContentRenderer {
274274
throw new UnsupportedOperationException("You cannot read the protocol in non-request rendering operations")
275275
}
276276
if (methodName == 'getScheme') {
277-
throw new UnsupportedOperationException("You cannot read the scheme in non-request rendering operations")
277+
return new URI(requestURI).scheme
278278
}
279279
if (methodName == 'getServerName') {
280-
throw new UnsupportedOperationException("You cannot read server name in non-request rendering operations")
280+
return new URI(requestURI).host
281281
}
282282
if (methodName == 'getServerPort') {
283-
throw new UnsupportedOperationException("You cannot read the server port in non-request rendering operations")
283+
return new URI(requestURI).host
284284
}
285285
if (methodName == 'getReader') {
286286
throw new UnsupportedOperationException("You cannot read input in non-request rendering operations")

0 commit comments

Comments
 (0)