Skip to content

Commit

Permalink
Remove regex usage from oauth2 test
Browse files Browse the repository at this point in the history
  • Loading branch information
kalaiyarasiganeshalingam committed Jul 31, 2023
1 parent 82bee80 commit d8b4766
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions stdlib-integration-tests/oauth2/tests/oauth2_test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// under the License.

import ballerina/http;
import ballerina/regex;
import ballerina/lang.regexp;
import ballerina/test;

listener http:Listener oauth2Listener = new(25003, {
Expand Down Expand Up @@ -93,10 +93,10 @@ service /oauth2 on authorizationServer {
resource function post token/introspect(http:Request request) returns json {
string|http:ClientError payload = request.getTextPayload();
if (payload is string) {
string[] parts = regex:split(payload, "&");
string[] parts = re `&`.split(payload);
foreach string part in parts {
if (part.indexOf("token=") is int) {
string token = regex:split(part, "=")[1];
string token = re `=`.split(part)[1];
if (token == ACCESS_TOKEN) {
json response = { "active": true, "exp": 3600, "scp": "read write" };
return response;
Expand Down

0 comments on commit d8b4766

Please sign in to comment.