diff --git a/src/main/java/com/jcabi/github/GhUser.java b/src/main/java/com/jcabi/github/GhUser.java index 132ffa98d..6ad4c12b4 100644 --- a/src/main/java/com/jcabi/github/GhUser.java +++ b/src/main/java/com/jcabi/github/GhUser.java @@ -64,6 +64,11 @@ final class GhUser implements User { */ private final transient Request request; + /** + * Login of the user. + */ + private final transient String self; + /** * Public ctor. * @param github Github @@ -86,6 +91,7 @@ final class GhUser implements User { } else { this.request = req.uri().path("/users").path(login).back(); } + this.self = login; } @Override @@ -100,7 +106,13 @@ public Github github() { @Override public String login() throws IOException { - return this.json().getString("login"); + final String login; + if (this.self.isEmpty()) { + login = this.json().getString("login"); + } else { + login = this.self; + } + return login; } @Override