Forum Discussion
junaidgill
6 years agoNew Contributor
I think I found at least one of the issues i.e. in the last line. It should be Paths.get(dirString + "/" + file.getName()).
So the latest script looks like this:
import java.nio.file.*
String userDir = context.expand('${projectDir}');
println userDir;
File dir = new File(userDir, "resm");
dir.mkdirs();
File file = new File(dir, "http_post.gz");
file.createNewFile();
Files.copy(new ByteArrayInputStream(mockRequest.requestContent.bytes), Paths.get( dir.toString() + "/" + file.getName() ) );
If the input contents are plain text then this script works fine but now for gzipped contents.
Any help is much appreciated here.
Related Content
- 2 years ago
Recent Discussions
- 15 years ago